-
Notifications
You must be signed in to change notification settings - Fork 12
/
webpack.config.js
49 lines (41 loc) · 1.17 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
/* eslint import/no-extraneous-dependencies: off */
// eslint-disable-next-line
'use strict'
const path = require('path')
const Webpack = require('webpack')
let buildPath = path.resolve(__dirname, 'dist', 'build')
const srcPath = path.resolve(__dirname, 'src')
const mainPath = path.resolve(__dirname, 'examples', 'main.js')
const publicPath = '/examples/build/'
const plugins = []
const entry = []
if (process.env.NODE_ENV !== 'production') {
entry.push(
// For hot style updates
'webpack/hot/dev-server',
// The script refreshing the browser on none hot updates
'webpack-dev-server/client?http://localhost:8080',
srcPath
)
plugins.push(new Webpack.HotModuleReplacementPlugin())
buildPath = path.resolve(__dirname, 'examples', 'build')
}
const output = {
filename: 'bundle.js',
path: buildPath,
publicPath
}
entry.push(mainPath)
module.exports = {
entry,
output,
plugins,
module: {
loaders: [
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.less$/, loader: 'style-loader!css-loader!less-loader' }
]
},
devtool: 'source-map',
}