forked from alvarotrigo/react-fullpage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.build.js
49 lines (43 loc) · 1.04 KB
/
webpack.config.build.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
const path = require('path');
const merge = require('webpack-merge');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const webpackConfig = require('./webpack.config');
const dirApp = path.join(__dirname, 'components');
const shared = {
entry: {
bundle: path.join(dirApp, 'index'),
},
optimization: {
minimize: false,
},
plugins: [new CleanWebpackPlugin(['dist'])],
};
module.exports = [
merge(webpackConfig, shared, {
// node module aliases
externals: {
react: 'react',
'react-dom': 'react-dom',
},
output: {
path: path.join(__dirname, 'dist'),
filename: 'react-fullpage.js',
library: 'ReactFullpage',
libraryTarget: 'commonjs2',
},
}),
merge(webpackConfig, shared, {
externals: {
// window aliases
react: 'React',
'react-dom': 'ReactDOM',
},
output: {
path: path.join(__dirname, 'dist'),
filename: 'react-fullpage-umd.js',
library: 'ReactFullpage',
libraryTarget: 'umd',
umdNamedDefine: true,
},
}),
];