-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathwebpack.config.js
62 lines (59 loc) · 1.36 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const webpack = require('webpack');
const path = require('path');
const pkg = require('./package.json');
require('babel-polyfill');
let libraryName = pkg.name;
module.exports = {
entry: ['./src/index'],
module: {
rules: [
{
test: /\.js?$/,
loader: 'babel-loader',
type: 'javascript/auto',
exclude: /node_modules/,
},
{
test: /\.css$/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
type: 'javascript/auto',
},
{
test: /\.(eot|svg|ttf|woff|woff2|otf)$/,
loader: 'file-loader?name=fonts/[name].[ext]',
type: 'javascript/auto',
},
],
},
resolve: {
modules: [path.resolve('./node_modules'), 'node_modules'],
extensions: ['.js'],
},
output: {
path: path.join(__dirname, '/dist'),
publicPath: '/',
filename: 'index.js',
library: libraryName,
libraryTarget: 'umd',
umdNamedDefine: true,
},
devServer: {
contentBase: './src',
hot: true,
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
],
optimization: {
minimize: false,
},
externals: {
'styled-components': {
commonjs: 'styled-components',
commonjs2: 'styled-components',
amd: 'styled-components',
},
},
};