forked from djenriquez/vault-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
66 lines (64 loc) · 2.16 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
62
63
64
65
66
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var path = require('path');
module.exports = function (env) {
let buildfor = (env && env.target) ? env.target : "web";
return {
target: buildfor,
entry: {
common: './app/App.jsx'
},
resolve: {
modules: [
"node_modules"
],
extensions: ['.js', '.jsx']
},
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: buildfor + '-bundle.js'
},
module: {
rules: [
{
test: /\.jsx?$/,
use: ['babel-loader?cacheDirectory=true']
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader?modules=true&localIdentName=[path][name]__[local]--[hash:base64:5]', 'postcss-loader']
}),
include: path.resolve(__dirname, './app')
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'postcss-loader']
}),
include: path.resolve(__dirname, './node_modules')
},
{
test: /\.ico$/,
use: ['file-loader?name=[name].[ext]']
},
{
test: /\.(svg|png)$/,
use: ['file-loader']
},
{
test: /\.(ttf|eot|woff(2)?)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: ["file-loader"]
},
]
},
plugins: [
new ExtractTextPlugin("styles.css"),
new webpack.IgnorePlugin(/regenerator|nodent|js-beautify/, /ajv/),
new webpack.DefinePlugin({ WEBPACK_DEF_TARGET_WEB: (buildfor == "web") })
]
}
};