forked from kookxiang/KK-Framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
61 lines (59 loc) · 1.48 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
53
54
55
56
57
58
59
60
61
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
var options = {
entry: {
Demo: './Resource/Demo/test.js',
Error: './Resource/Misc/Error.css'
},
resolve: {
alias: {
'react': 'react-lite',
'react-dom': 'react-lite'
},
extensions: [".js", ".jsx"]
},
module: {
rules: [
{
test: /\.(sa|sc|c)ss$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: [
"css-loader",
{
loader: "postcss-loader",
options: {
plugins: [
require("autoprefixer")({ browsers: ["ie >= 9", "> 2%", "last 1 version"] })
]
}
},
"sass-loader"
]
})
}, {
test: /\.(jpe?g|gif|png|svg|woff\d*|ttf|eot)(\?.*|#.*)?$/,
use: "file-loader?limit=8192&name=Assert/[hash:hex:6].[ext]"
}, {
test: /\.js|jsx$/,
exclude: /(node_modules|bower_components)/,
loader: "babel-loader",
options: {
presets: ["es2015", "react"]
}
}
]
},
output: {
path: path.resolve(__dirname, "Public/Resource"),
filename: '[name].js',
publicPath: '/Resource/'
},
plugins: [
new ExtractTextPlugin("[name].css")
]
};
module.exports = function(env){
return require('./.webpack/' + (env == 'prod' ? 'prod' : 'dev') + '.js')(options);
};