forked from handsontable/formula-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
42 lines (38 loc) · 930 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
'use strict';
const webpack = require('webpack');
const path = require('path');
const ROOT_DIRECTORY = process.cwd();
const NODE_ENV = process.env.NODE_ENV;
const config = {
mode: 'production',
devtool: false,
entry: {
main: path.resolve(ROOT_DIRECTORY, 'src/index.js'),
},
output: {
library: 'formulaParser',
libraryTarget: 'umd',
path: path.resolve(ROOT_DIRECTORY, 'dist'),
filename: `formula-parser${NODE_ENV === 'production' ? '.min' : ''}.js`,
umdNamedDefine: true,
},
module: {
rules: [
{
test: /\.js$/,
loaders: ['babel-loader'],
exclude: /node_modules|grammar\-parser\.js$/
},
]
},
optimization: {
minimize: NODE_ENV === 'production',
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(NODE_ENV)
})
]
};
module.exports = config;