-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
47 lines (44 loc) · 953 Bytes
/
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
/* global __dirname */
const webpack = require('webpack')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const path = require('path')
const packageJson = require('./package.json')
const config = {
entry: {
index: './src/index',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js', // produces only index.js
library: packageJson.name,
libraryTarget: 'umd',
},
externals: {
// react: 'commonjs react',
// 'react-dom': 'commonjs react-dom',
react: 'react',
'react-dom': 'react-dom',
},
resolve: {
modules: ['node_modules'],
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader',
},
],
},
optimization: {
minimize: process.env.NODE_ENV === 'production',
},
plugins: [
new CleanWebpackPlugin(['build']),
],
stats: {
children: false,
},
}
module.exports = config