-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.build.js
148 lines (128 loc) · 4.44 KB
/
webpack.build.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
var webpack = require('webpack');
var helpers = require('./helpers');
var CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
debug: false,
devtool: 'cheap-module-source-map',
entry: {
'ng-bs-switch': './src/ng-bs-switch.ts'
},
output: {
path: helpers.root('dist'),
filename: '[name].js',
sourceMapFilename: '[name].map',
chunkFilename: '[id].chunk.js',
libraryTarget: 'umd',
},
externals: {
// require("jquery") is external and available
// on the global var jQuery
"angular": "angular"
},
// Options affecting the resolving of modules.
//
// See: http://webpack.github.io/docs/configuration.html#resolve
resolve: {
// An array of extensions that should be used to resolve modules.
//
// See: http://webpack.github.io/docs/configuration.html#resolve-extensions
extensions: ['', '.ts', '.js'],
root: helpers.root('src'),
// remove other default values
modulesDirectories: ['node_modules']
},
// Options affecting the normal modules.
//
// See: http://webpack.github.io/docs/configuration.html#module
module: {
// An array of applied pre and post loaders.
//
// See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders
preLoaders: [
// Tslint loader support for *.ts files
//
// See: https://github.com/wbuchwalter/tslint-loader
// { test: /\.ts$/, loader: 'tslint-loader', exclude: [ helpers.root('node_modules') ] },
// Source map loader support for *.js files
// Extracts SourceMaps for source files that as added as sourceMappingURL comment.
//
// See: https://github.com/webpack/source-map-loader
{
test: /\.js$/,
loader: 'source-map-loader',
exclude: [
// these packages have problems with their sourcemaps
helpers.root('node_modules/rxjs')
]
}
],
// An array of automatically applied loaders.
//
// IMPORTANT: The loaders here are resolved relative to the resource which they are applied to.
// This means they are not resolved relative to the configuration file.
//
// See: http://webpack.github.io/docs/configuration.html#module-loaders
loaders: [
// Typescript loader support for .ts and Angular 2 async routes via .async.ts
//
// See: https://github.com/s-panferov/awesome-typescript-loader
{
test: /\.ts$/,
loader: 'awesome-typescript-loader',
exclude: [/\.(spec|e2e)\.ts$/]
},
// Json loader support for *.json files.
//
// See: https://github.com/webpack/json-loader
{
test: /\.json$/,
loader: 'json-loader'
},
// Raw loader support for *.html
// Returns file content as string
//
// See: https://github.com/webpack/raw-loader
{
test: /\.html$/,
loader: 'raw-loader',
exclude: [helpers.root('playground/index.html')]
},
{
test: /\.scss/,
loader: 'css-loader!sass-loader'
}, {
test: /\.eot(\?.+)?$/,
loader: "file"
}, {
test: /\.(woff|woff2)(\?.+)?$/,
loader: "url?limit=5000&minetype=application/font-woff"
}, {
test: /\.ttf(\?.+)?$/,
loader: "url?limit=10000&mimetype=application/octet-stream"
}, {
test: /\.svg(\?.+)?$/,
loader: "url?limit=10000&mimetype=image/svg+xml"
}
]
},
plugins: [
new CopyWebpackPlugin([{
from: 'src/ng-bs-switch.scss',
to: './ng-bs-switch.scss'
}, {
from: 'src/_variables.scss',
to: './_variables.scss'
}, {
from: 'src/_mixins.scss',
to: './_mixins.scss'
}])
],
node: {
global: 'window',
crypto: 'empty',
process: true,
module: false,
clearImmediate: false,
setImmediate: false
}
};