-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
73 lines (65 loc) · 1.78 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
68
69
70
71
72
73
const webpack = require('webpack');
const path = require('path');
const config = {
context: __dirname + '/src',
// the entry point of your library
entry: './index.js',
// where 3rd-party modules can reside
resolve: {
modulesDirectories: ['node_modules', 'bower_components'],
},
output: {
// where to put standalone build file
path: path.join(__dirname, 'dist'),
publicPath: '/dist/',
// the name of the standalone build file
filename: 'bundle.js',
// the standalone build should be wrapped in UMD for interop
libraryTarget: 'umd',
// the name of your library in global scope
library: 'KotoConfig',
},
externals: {},
plugins: [
new webpack.DefinePlugin({
ON_DEV: process.env.NODE_ENV === 'development' || !process.env.NODE_ENV,
ON_TEST: process.env.NODE_ENV === 'test',
ON_PROD: process.env.NODE_ENV === 'production',
}),
new webpack.IgnorePlugin(/regenerator|nodent|js\-beautify/, /ajv/),
],
module: {
preLoaders: [
{
test: /\.js$/,
loader: 'eslint-loader',
exclude: /(node_modules|bower_components)/,
},
],
loaders: [{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
cacheDirectory: true,
presets: ['es2015-loose', 'stage-1'],
plugins: ['transform-runtime', 'transform-decorators-legacy'], // transform-decorators
},
}],
},
devtool: 'source-map',
devServer: {
contentBase: '',
noInfo: false, // --no-info option
hot: true,
inline: true,
stats: false,
debug: false,
progress: false,
quite: true,
},
};
if (process.env.NODE_ENV === 'production') {
config.plugins.push(new webpack.optimize.UglifyJsPlugin());
}
module.exports = config;