forked from jumpinjackie/mapguide-react-layout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
106 lines (91 loc) · 2.3 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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
'use strict';
const path = require('path');
const webpack = require('webpack');
const loaders = require('./webpack/loaders');
const baseAppEntries = [
'./src/entries/library.tsx',
];
const devAppEntries = [
// 'webpack-hot-middleware/client?reload=true',
];
const appEntries = baseAppEntries.concat(process.env.NODE_ENV === 'development' ? devAppEntries : []);
const vendorEntries = [
'react',
'react-dom'
];
const basePlugins = [
new webpack.ProvidePlugin({
"proj4": "proj4"
}),
new webpack.DefinePlugin({
__DEV__: process.env.NODE_ENV !== 'production',
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
];
const devPlugins = [
new webpack.NoEmitOnErrorsPlugin(),
];
const prodPlugins = [
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false,
options: {
context: __dirname
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false,
screw_ie8: true
},
comments: false
})
];
const plugins = basePlugins
.concat(process.env.NODE_ENV === 'production' ? prodPlugins : [])
.concat(process.env.NODE_ENV === 'development' ? devPlugins : []);
module.exports = {
entry: {
viewer: appEntries
//app: appEntries,
//vendor: vendorEntries
},
output: {
libraryTarget: "var",
library: "MapGuide",
path: path.join(__dirname, 'viewer/dist'),
//filename: '[name].[hash].js',
filename: '[name].js',
publicPath: '/',
//sourceMapFilename: '[name].[hash].js.map',
sourceMapFilename: '[name].js.map',
chunkFilename: '[id].chunk.js'
},
devtool: 'source-map',
resolve: {
alias: {},
modules: [
'node_modules'
],
extensions: ['.webpack.js', '.web.js', '.tsx', '.ts', '.js']
},
plugins: plugins,
module: {
rules: [
loaders.tsx,
loaders.html,
loaders.css,
loaders.less,
loaders.fonts,
/*
loaders.svg,
loaders.eot,
loaders.woff,
loaders.woff2,
loaders.ttf,
*/
loaders.image
]
}
};