-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
45 lines (44 loc) · 1.02 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
const path = require('path');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
module.exports = {
devtool: 'source-map',
entry: './src/index.js',
output: {
publicPath: 'lib/',
path: path.resolve(__dirname, 'lib'),
filename: 'redux-autoloader.js',
sourceMapFilename: 'redux-autoloader.js.map',
library: 'redux-autoloader',
libraryTarget: 'commonjs2',
},
externals: {
react: 'react',
'react-redux': 'react-redux',
'redux-saga': 'redux-saga',
redux: 'redux',
'redux-saga/effects': 'redux-saga/effects',
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
loader: 'eslint-loader',
exclude: /node_modules/,
},
{
test: /\.js$/,
loader: 'babel-loader',
query: {
plugins: ['@babel/transform-runtime'],
},
exclude: /node_modules/,
},
],
},
plugins: [
...(process.env.ANALYZE_BUNDLE === 'true'
? [new BundleAnalyzerPlugin()]
: []),
],
};