-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
70 lines (63 loc) · 1.59 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
const Path = require('path')
const Webpack = require('webpack')
const rootDir = __dirname
const SHARED_STYLE_EXTENSIONS = ['style', 'css']
const inProd = process.env.NODE_ENV === 'production'
const plugins = [
new Webpack.DefinePlugin({'process.env.LOG_LEVEL': JSON.stringify(process.env.LOG_LEVEL)}),
new Webpack.optimize.OccurenceOrderPlugin()
]
const explodingTiles = [
'./new-school/index.js',
'./assets/css/index.css'
]
const hslWorker = [
'./new-school/workers/hsl.js'
]
if (!inProd) {
plugins.push(
new Webpack.NoErrorsPlugin(),
new Webpack.HotModuleReplacementPlugin()
)
explodingTiles.push('webpack-hot-middleware/client')
hslWorker.push('webpack-hot-middleware/client')
}
module.exports = {
context: rootDir,
devtool: '#eval-source-map',
entry: {
explodingTiles : explodingTiles,
hslWorker : hslWorker
},
output: {
path: Path.join(rootDir, 'js'),
filename: '[name].js',
publicPath: '/js'
},
plugins: plugins,
resolve: {
extensions: ['', '.js'],
modulesDirectories: ['node_modules'],
alias: { },
fallback: Path.join(__dirname, '..', 'node_modules')
},
resolveLoader: { fallback: Path.join(__dirname, '..', 'node_modules') },
eslint: {
configFile: Path.join(rootDir, '.eslintrc')
},
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
}, {
test: /\.css$/,
loaders: SHARED_STYLE_EXTENSIONS
}]
},
node: {
// http://stackoverflow.com/questions/25553868/current-file-path-in-Webpack
__filename : true,
fs : 'empty'
}
}