forked from eile/hiking-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
95 lines (93 loc) · 2.12 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
const webpack = require('webpack');
const ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin');
const TSLintPlugin = require('tslint-webpack-plugin');
const path = require('path');
module.exports = {
entry: {
main: [
'./src/ts/main.ts'
]
},
output: {
filename: './dist/[name].bundle.js',
/* path: path.join(__dirname, 'dist'),
filename: '[name].bundle.js', */
libraryTarget: 'amd'
},
module: {
loaders:[
{
test: /\.json$/,
loader: 'json-loader'
}
],
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /(node_modules)/,
use: {
loader: 'awesome-typescript-loader'
}
},
{
// Capture eot, ttf, woff, and woff2
test: /\.(eot|ttf|woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
use: {
loader: "file-loader"
},
},
{
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "sass-loader"
}],
},
{
test: /\.(jpe?g|png|gif|svg)$/,
use: [
{ loader: "url-loader" }
]
}
]
},
resolve: {
extensions: ['.ts', '.js', '.json']
},
devtool: 'eval-source-map',
plugins: [
new ServiceWorkerWebpackPlugin({
entry: path.join(__dirname, 'src/ts/sw.ts'),
filename: '../sw.js',
publicPath: '/hiking-app/dist/'
}),
new TSLintPlugin({
files: ['./src/ts/**/*.ts']
})
/* new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity
}) */
],
devServer: {
contentBase: __dirname
},
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)
) {
return callback(null, 'amd ' + request);
}
callback();
}
]
}