Newer
Older
const common = require('./webpack.common.js')
const path = require('path')
const ngtools = require('@ngtools/webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const AngularCompilerPlugin = ngtools.AngularCompilerPlugin
const ClosureCompilerPlugin = require('webpack-closure-compiler')
Xiao Gui
committed
const merge = require('webpack-merge')
const staticAssets = require('./webpack.staticassets')
const TerserPlugin = require('terser-webpack-plugin')
const webpack = require('webpack')
entry : {
filename : '[name].js',
path : path.resolve(__dirname,'dist/aot')
},
module: {
rules: [
{
use : {
loader : 'file-loader',
options: {
name : '[name].[ext]'
}
}
},
{
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
loader: '@ngtools/webpack',
exclude : /third_party|plugin_example|spec\.ts$/
exclude : /export\_nehuba|index|res\/css|plugin_example|material\/prebuilt-themes/,
Xiao Gui
committed
},
{
test : /res\/css.*?css$/,
use : {
loader : 'file-loader',
options : {
name : '[name].[ext]'
}
}
}
]
},
plugins : [
new HtmlWebpackPlugin({
template : 'src/index.html'
}),
new AngularCompilerPlugin({
tsConfigPath: 'tsconfig-aot.json',
entryModule: 'src/main.module#MainModule',
directTemplateLoading: true
}),
new webpack.DefinePlugin({
// TODO have to figure out how to set this properly
// needed to avoid inline eval
// shouldn't mode: 'production' do that already?
ngDevMode: false,
ngJitMode: false
new TerserPlugin({
extractComments: false
})
Xiao Gui
committed
],
alias : {
"third_party" : path.resolve(__dirname,'third_party'),
"src" : path.resolve(__dirname,'src')
Xiao Gui
committed
}