-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.js
48 lines (45 loc) · 1 KB
/
compile.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
const path = require('path');
const webpack = require("webpack");
const ngToolsWebpack = require('@ngtools/webpack');
const compiler = webpack({
watch: true,
entry: './src/main/main.ts',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
resolve: {
extensions: ['.js', '.ts'],
alias: {
'shared': path.resolve(__dirname, 'src/shared'),
},
modules: ['node_modules'],
},
plugins: [
new ngToolsWebpack.AngularCompilerPlugin({
tsConfigPath: path.resolve(__dirname, 'src/tsconfig.json'),
entryModule: path.resolve(__dirname, 'src/main/app/app.module#AppModule'),
skipCodeGeneration: true,
}),
],
module: {
rules: [
{ test: /\.html$/, use: [
{ loader: 'raw-loader' },
]},
{
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
exclude: [/node_modules/, /\.spec\.(js|ts)$/],
loader: '@ngtools/webpack',
},
]
},
});
compiler.watch({
poll: 1000
}, function(err, stats) {
console.error(stats.toString({
normal: true,
colors: true
}));
});