/
webpack.config.js
44 lines (41 loc) · 1.21 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
var path = require('path')
var WebpackIsoToolsPlugin = require('webpack-isomorphic-tools/plugin')
var webpack = require('webpack')
var isomorphicPlugin = new WebpackIsoToolsPlugin(require('./webpack-isomorphic-tools.config.js'))
var __DEV__ = process.env.NODE_ENV == 'dev'
if (__DEV__) {
isomorphicPlugin = isomorphicPlugin.development()
}
module.exports = {
context: path.resolve(__dirname),
entry: {
main: [
'webpack-dev-server/client?http://localhost:9099',
'webpack/hot/dev-server',
'./index.js',
]
},
output: {
path: path.resolve(__dirname, 'build'),
publicPath: 'http://localhost:9099/static/', // To fix error: Syntax error: Unexpected token <
filename: `[name].js` // by default, name = main
},
module: {
loaders: [
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'sass'] // It is required to use ALL loaders and in this specific order!
// loaders: ['css', 'sass'] // It is required to use ALL loaders and in this specific order!
},
],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
// new webpack.NoErrorsPlugin(),
isomorphicPlugin
]
}