This repository was archived by the owner on Jul 2, 2025. It is now read-only.
forked from mhaagens/react-mobx-react-router4-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathwebpack.config.js
More file actions
86 lines (85 loc) · 2.73 KB
/
Copy pathwebpack.config.js
File metadata and controls
86 lines (85 loc) · 2.73 KB
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
var path = require("path");
var webpack = require("webpack");
var precss = require("precss");
var autoprefixer = require("autoprefixer");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: [
"react-hot-loader/patch",
"babel-polyfill",
"whatwg-fetch",
"webpack-dev-server/client?http://localhost:3000",
"webpack/hot/only-dev-server",
"./src/index"
],
output: {
path: path.join(__dirname, "dist"),
publicPath: "/",
filename: "static/js/app.[hash].js"
},
devtool: "eval",
module: {
loaders: [
{
test: /\.js|.jsx$/,
exclude: /node_modules/,
loader: "babel-loader",
query: {
presets: [
[ "es2015", { modules: false } ],
"stage-0",
"react"
],
plugins: [
"transform-async-to-generator",
"transform-decorators-legacy"
]
}
},
{
test: /\.scss|css$/,
loader: "style-loader!css-loader!postcss-loader!resolve-url-loader!sass-loader?sourceMap"
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
"file-loader?hash=sha512&digest=hex&name=assets/images/[hash].[ext]",
"image-webpack-loader?bypassOnDebug&optimizationLevel=7&interlaced=false"
]
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff"
},
{
test: /\.(ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader"
}
]
},
resolve: {
extensions: ['*', '.js', '.jsx']
},
plugins: [
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin("assets/styles/styles.css"),
new HtmlWebpackPlugin({
hash: false,
template: "./index.hbs"
}),
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /nb/),
new webpack.LoaderOptionsPlugin({
test: /\.scss$/,
debug: true,
options: {
postcss: function() {
return [ precss, autoprefixer ];
},
context: path.join(__dirname, "src"),
output: { path: path.join(__dirname, "dist") }
}
})
]
};