-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.webpack.js
62 lines (56 loc) · 1.44 KB
/
dev.webpack.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
const path = require('path');
const fs = require('fs');
const { dependencies } = require('./package.json');
const webpack = require('webpack');
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function(x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function(mod) {
nodeModules[mod] = 'commonjs2 ' + mod;
});
module.exports = {
context: __dirname,
devtool: 'source-map',
entry: ['babel-polyfill', 'webpack/hot/dev-server','./javascripts/index.js'],
output: {
path: path.resolve(__dirname || process.cwd(), 'public'),
filename: 'bundle.js',
publicPath: 'http://localhost:8080/built/'
},
devServer: {
contentBase: path.resolve(__dirname, 'public'),
publicPath: 'http://localhost:8080/built/'
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.css$/,
loaders: [
'style-loader',
'css-loader?importLoaders=1&localIdentName=[path]_[name]_[local]__[hash:base64:5]',
'postcss-loader'
]
},
{
test: /\.(jpg|png|woff|woff2|eot|otf|ttf|svg)$/,
loader: 'url-loader?limit=100000'
}
]
},
externals: nodeModules,
target: 'electron',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
]
// resolve: {
// extensions: ['', '.js', '.jsx', '.json', '.node' ]
// }
}