-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
134 lines (108 loc) · 2.66 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
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
const webpack = require('webpack');
const helpers = require('./config/helpers');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;
const DefinePlugin = require('webpack/lib/DefinePlugin');
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin');
const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 3000;
const METADATA = {
title: 'angular2-input-masks',
host: HOST,
port: PORT,
ENV: ENV,
baseUrl: '/',
isDevServer: helpers.isWebpackDevServer()
};
module.exports = {
metadata: METADATA,
// devtool: 'cheap-module-source-map',
entry: './src/index.ts',
output: {
path: helpers.root('dist'),
filename: 'src/index.js',
library: 'angular2-input-masks',
libraryTarget: 'umd',
umdNamedDefine: true
},
externals: [
'@angular/core',
'@angular/common',
'@angular/compiler',
'@angular/forms'
],
resolve: {
extensions: ['', '.ts', '.js', '.json'],
root: helpers.root('src'),
modulesDirectories: ['node_modules'],
},
module: {
preLoaders: [],
loaders: [
{
test: /\.ts$/,
loaders: [
'awesome-typescript-loader',
'angular2-template-loader'
],
exclude: [/\.(spec|e2e)\.ts$/]
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.css$/,
loaders: ['to-string-loader', 'css-loader']
},
{
test: /\.html$/,
loader: 'raw-loader',
exclude: []
},
{
test: /\.(jpg|png|gif)$/,
loader: 'file'
}
]
},
plugins: [
new ForkCheckerPlugin(), //Do type checking in a separate process, so webpack doesn't need to wait.
// new CopyWebpackPlugin([{
// from: 'src/assets',
// to: 'assets'
// }]),
new DefinePlugin({
'ENV': JSON.stringify(METADATA.ENV),
'process.env': {
'ENV': JSON.stringify(METADATA.ENV),
'NODE_ENV': JSON.stringify(METADATA.ENV),
}
}),
// new NamedModulesPlugin(), // Description: Uses file names as module name.
],
tslint: {
emitErrors: false,
failOnHint: false,
resourcePath: 'src'
},
devServer: {
port: METADATA.port,
host: METADATA.host,
historyApiFallback: true,
watchOptions: {
aggregateTimeout: 300,
poll: 1000
},
outputPath: helpers.root('dist')
},
node: {
global: 'window',
crypto: 'empty',
process: true,
module: false,
clearImmediate: false,
setImmediate: false
}
};