-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.js
128 lines (127 loc) · 3.84 KB
/
webpack.config.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import path from 'path';
import webpack from 'webpack';
import combineLoaders from 'webpack-combine-loaders';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import ScriptExtHtmlWebpackPlugin from 'script-ext-html-webpack-plugin';
export default {
mode: 'development',
devtool: 'eval-source-map',
cache: true,
entry: [
'./src/webpack-public-path',
'webpack-hot-middleware/client?reload=true',
path.resolve(__dirname, './src/index.js')
],
target: 'web',
output: {
path: path.join(__dirname, "dist"),
filename: 'dashboard.js',
sourceMapFilename: 'dashboard.map.js'
},
resolve: {
extensions: ['*', '.js', '.elm']
},
resolveLoader: {
modules: [path.resolve(__dirname, 'tools'), 'node_modules']
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
__DEV__: true
}),
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
template: 'src/index.ejs',
minify: {
removeComments: false,
collapseWhitespace: true
},
inject: 'head'
}),
new ScriptExtHtmlWebpackPlugin({
defaultAttribute: 'defer'
})
],
optimization: {
noEmitOnErrors: true,
splitChunks: {
cacheGroups: {
default: false,
commons: {
// Do not include nexosis-styles as a vendor css file.
test: /[\\/]node_modules[\\/](?!nexosis)/,
name: 'vendor',
chunks: 'all'
}
}
}
},
module: {
rules: [
{
loader: 'babel-loader',
test: /\.js&/,
exclude: [/elm-stuff/, /node_modules/],
},
{
test: /\.elm$/,
exclude: [/elm-stuff/, /node_modules/],
loader: combineLoaders([
{
loader: 'elm-hot-loader'
},
{
loader: 'elm-webpack-loader?verbose=true&warn=true&debug=true&pathToMake=' + __dirname + '/node_modules/.bin/elm-make&cwd=' + __dirname + '&forceWatch=true'
}
])
},
{
test: /(\.css|\.scss|\.sass)$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
loader: 'postcss-loader',
options: {
plugins: () => [
require('autoprefixer')
],
sourceMap: true
}
},
{
loader: 'sass-loader',
options: {
sourceMap: true
}
}
]
},
{
type: 'javascript/auto',
test: /(config)\.json$/,
use: [
{
loader: 'file-loader',
options: { name: '[name].[ext]' }
}
, 'config-loader'
]
},
{
test: /(\.md)$/,
use: [
{
loader: 'file-loader',
options: { name: 'docs/[name].[ext]' }
}
]
}
]
}
};