-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.dev.js
79 lines (70 loc) · 2.05 KB
/
webpack.dev.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
71
72
73
74
75
76
77
78
79
'use strict'
const resolve = require('path').resolve
const process = require('process')
const webpack = require('webpack')
const NotifierPlugin = require('webpack-notifier')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const appDir = resolve(__dirname, './app/src')
module.exports = {
// https://github.com/webpack/webpack/issues/1599#issuecomment-186841345
// __dirname returns '/' when js file is built with webpack
target: 'node',
node: {
__dirname: false,
__filename: false,
},
entry: {
'index.js': './app/src/index.js',
'entry.js': './app/src/entry.js',
},
devtool: "source-map",
//devtool: 'cheap-module-source-map',
//devtool: 'eval',
output: {
pathinfo: true,
path: './app/dist',
filename: '[name]',
sourceMapFilename: '[name].map',
},
module: {
preLoaders: [
{ test: /\.js$/, include: appDir, loader: 'eslint' },
],
loaders: [
{ test: /\.json$/, include: appDir, loader: 'json' },
{ test: /\.js$/, include: appDir, loader: 'babel' },
{ test: /\.scss$/, include: appDir, loaders: ["style", "css?modules&sourceMap", "sass?sourceMap"] },
{ test: /.node$/, include: appDir, loader: 'node' },
{ test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/, loader: 'url-loader?limit=100000&name=[path][name].[ext]'}
]
},
resolve: {
extensions: ['', '.js'],
packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main'],
},
externals: [
(ctx, req, cb) => {
if (/^[electron|react|nodegit]/.test(req)) {
return cb(null, `commonjs ${req}`)
}
cb()
},
],
plugins: [
new NotifierPlugin({ alwaysNotify: true }),
new webpack.NoErrorsPlugin(),
new CopyWebpackPlugin([{
from: resolve(appDir, 'index.html'),
to: 'index.html'
}, {
from: resolve(appDir, 'assets/logo/'),
to: 'assets/logo/'
}]),
new webpack.ProvidePlugin({
Promise: 'bluebird',
}),
new webpack.DefinePlugin({
__DEVTOOLS__: true, // <-------- DISABLE redux-devtools HERE
}),
],
}