This repository has been archived by the owner on May 11, 2018. It is now read-only.
forked from lobsteropteryx/esri-webpack-typescript
-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
65 lines (64 loc) · 1.93 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
var webpack = require('webpack');
module.exports = {
entry: {
// entry point for your application code
main: [
'./src/app/main.js'
],
// put your third party libs here
// vendor: []
},
output: {
filename: './dist/[name].bundle.js',
publicPath: './',
// the bundled output will be loaded by the Dojo AMD loader
// that is included in the ArcGIS API for JavaScript
libraryTarget: 'amd'
},
resolve: {
extensions: ['.webpack.js', '.web.js', '.js', '.jsx']
},
module: {
rules: [
// ES2015 files
{
test: /\.(js|jsx)$/,
loader: 'babel-loader'
},
// css
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity
})
],
externals: [
function(context, request, callback) {
// exclude any esri or dojo modules from the bundle
// these are included in the ArcGIS API for JavaScript
// and its Dojo loader will pull them from its own build output
if (/^dojo/.test(request) ||
/^dojox/.test(request) ||
/^dijit/.test(request) ||
/^esri/.test(request) ||
// ordinarily you would only need to speficy the above prefixes,
// but because we include a third-party Dojo module in this example
// we need to add it's package to the list of prefixes to exclude
/^cluster-layer-js/.test(request)
) {
return callback(null, 'amd ' + request);
}
callback();
}
],
devtool: 'source-map'
};