-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.config.js
More file actions
91 lines (89 loc) · 2.71 KB
/
base.config.js
File metadata and controls
91 lines (89 loc) · 2.71 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
87
88
89
90
91
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin");
const hotMiddlewareScript = "webpack-hot-middleware/client?reload=true";
const path = require('path');
module.exports = {
entry: {
vendors: ["react", "react-dom"],
app: ["./src/index.js",hotMiddlewareScript]
},
output: {
path: path.resolve(__dirname, "./dist"),
filename: "[name].[hash].js",
publicPath: "/"
},
externals: {
"react": "React",
"react-dom": "ReactDOM"
},
module: {
rules: [{
test: /\.js[x]?$/,
exclude: /(node_modules)/,
include: path.resolve("src"),
use: [{
loader: "babel-loader"
}]
}, {
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: ["css-loader","postcss-loader"],
fallback: "style-loader"
})
},{
test: /\.less$/,
use: ExtractTextPlugin.extract({
use: ['css-loader', 'postcss-loader', 'less-loader'],
fallback: 'style-loader'
})
}, {
test: /\.(png|jpg|jpeg|gif)(\?.+)?$/,
exclude: /favicon\.png$/,
use: [{
loader: "url-loader",
options: {
limit: 10000,
name: "[name].[hash:8].[ext]"
}
}]
}, {
test: /\.(eot|ttf|woff|woff2|svg|svgz)(\?.+)?$/,
use: [{
loader: "file-loader",
options: {
name: "[name].[hash:8].[ext]"
}
}]
}]
},
plugins: [
new CommonsChunkPlugin({
name: "vendors"
}),
new ExtractTextPlugin({
filename: "[name].[hash].css"
}),
new HtmlWebpackPlugin({
filename: "index.html",
template: "./src/index.html",
inject: "body",
hash: false,
favicon : "./src/assets/images/favicon.png",
chunks: ["vendors", "app"]
}),
],
resolve: {
extensions: [
".jsx", ".js"
],
alias: {
components: path.resolve(__dirname, "src/components/"),
assets: path.resolve(__dirname, "src/assets/"),
containers: path.resolve(__dirname, "src/containers/"),
utils: path.resolve(__dirname, "src/utils/"),
serve: path.resolve(__dirname, "src/serve/"),
model: path.resolve(__dirname, "src/models/")
}
}
}