-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
52 lines (51 loc) · 1.36 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
var path = require("path");
var webpack = require("webpack");
var BundleTracker = require("webpack-bundle-tracker");
var ExtractText = require("extract-text-webpack-plugin");
module.exports = {
entry: [
"webpack-dev-server/client?http://localhost:3000",
"webpack/hot/only-dev-server",
"./turkers/chats/react/src/js/index"
],
output: {
path: path.resolve("./turkers/chats/react/bundles/"),
filename: "[name]-[hash].js",
publicPath: "http://localhost:3000/static/chats/react/bundles/" // Tell django to use this URL to load packages and not use STATIC_URL + bundle_name
},
module: {
rules: [
{
test: /\.jsx?$/,
loader: "babel-loader",
exclude: /node_modules/
},
{
test: /\.css$/,
loader: ["style-loader", "css-loader"]
},
{
test: /\.scss$/,
use: ExtractText.extract({
fallback: "style-loader",
use: ["css-loader", "sass-loader"]
})
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(), // don't reload if there is an error
new BundleTracker({
path: __dirname,
filename: "turkers/webpack-stats.json"
}),
new ExtractText({
filename: "[name]-[hash].css"
})
],
resolve: {
modules: ["node_modules"],
extensions: [".js", ".jsx"]
}
};