This repository has been archived by the owner on Aug 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.dev.config.js
59 lines (48 loc) · 1.78 KB
/
webpack.dev.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
var path = require("path"),
webpack = require('webpack'),
autoprefixer = require('autoprefixer-core'),
csswring = require('csswring');
module.exports = {
context: __dirname,
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./src/index'
],
output: {
path: path.resolve('./bundles/'),
filename: "[name].js"
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(), // don't reload if there is an error
new webpack.ResolverPlugin([
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("package.json", ["main"])
]),
new webpack.ProvidePlugin({
'_': "lodash",
'd3': "d3",
'cx': "classnames"
})
],
module: {
loaders: [
// SASS support: transform from SCSS into CSS
{ test: /\.scss$/, exclude: /node_modules/, loader: 'style!css!postcss!sass?sourceMap' },
// React support: transform JSX into JS
{ test: /\.jsx?$/, exclude: /node_modules/, loader: 'react-hot-loader!babel?{"stage":1}!eslint'},
// Loader for fonts
{ test: /\.woff2?($|\?)/, loader: "url?limit=10000&minetype=application/font-woff" },
{ test: /\.ttf($|\?)/, loader: "url?limit=10000&minetype=application/octet-stream" },
{ test: /\.eot($|\?)/, loader: "file" },
{ test: /\.svg($|\?)/, loader: "url?limit=10000&minetype=image/svg+xml" },
]
},
resolve: {
root: [path.join(__dirname, "./node_modules"), path.join(__dirname, "./src")],
extensions: ['', '.js', '.jsx']
},
postcss: function () {
return [autoprefixer, csswring];
}
};