This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathwebpack.config.js
67 lines (63 loc) · 1.6 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
63
64
65
66
67
var webpack = require('webpack');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'dist');
var APP_DIR = path.resolve(__dirname, '.');
var plugins = [
new webpack.ProvidePlugin({
'Intl': 'imports?this=>global!exports?global.Intl!intl'
})
];
var filename = '[name].js';
var PROD = JSON.parse(process.env.BUILD_PROD || false);
if(PROD) {
plugins.push(new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify('production') } }));
plugins.push(new webpack.optimize.UglifyJsPlugin({ compress:{ warnings: true } }));
filename = '[name].min.js';
}
module.exports = {
entry: {
Viewer: APP_DIR + '/src/viewer.jsx',
Composer: APP_DIR + '/src/composer.jsx'
},
output: {
path: BUILD_DIR,
filename: filename,
library: '[name]',
libraryTarget: 'umd',
umdNamedDefine: true,
publicPath: "/dist/"
},
node: {fs: "empty"},
plugins: plugins,
resolve: {
extensions: ['', '.js', '.jsx']
},
resolveLoader: {
root: path.join(__dirname, 'node_modules')
},
module: {
loaders: [
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/
}, {
test: /\.css$/,
loader: "style-loader!css-loader"
}, {
test: /\.json$/,
loader: "json-loader"
}, {
test: /\.(png|gif|jpg|jpeg|svg|otf|ttf|eot|woff)$/,
loader: 'file-loader'
}
],
noParse: [/dist\/ol.js/, /dist\/jspdf.debug.js/]
},
externals: {
'cheerio': 'window',
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true
}
};