-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
59 lines (48 loc) · 1.29 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
'use strict';
let webpack = require('webpack');
let path = require('path');
let util = require('gulp-util');
let config = require('./gulp/config');
const nodeModulesPath = path.resolve(__dirname, 'node_modules');
const NODE_ENV = process.env.NODE_ENV || 'development';
const configs = {
// sourcemaps for development version
devtool: NODE_ENV === 'development' ? 'source-map' : null,
// entry points of out application
entry: [
`${__dirname}/src/js/app.js`
],
output: {
path: `${__dirname}/build/js`,
filename: 'app.js',
publicPath: '/build/'
},
resolve: {
modules: [
'node_modules'
],
extensions: ['.js']
},
resolveLoader: {
extensions: ['.js']
},
// add nessessary modules here
module: {
rules: [
// this loader allow you to use ES6/7 syntax and SX transpiling out of the box
{
test: /\.js$/,
use: 'babel-loader',
exclude: nodeModulesPath
}
]
},
// add nessessary plugins here
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
NODE_ENV: JSON.stringify(NODE_ENV)
})
]
};
module.exports = configs;