Skip to content
Snippets Groups Projects
Commit afdb42a2 authored by Xiao Gui's avatar Xiao Gui
Browse files

merged webpack configs

parent 28506707
No related branches found
No related tags found
No related merge requests found
const webpack = require('webpack')
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ngtools = require('@ngtools/webpack')
const AngularCompilerPlugin = ngtools.AngularCompilerPlugin
const merge = require('webpack-merge')
const staticAssets = require('./webpack.staticassets')
const commonAot = {
entry: {
main: './src/main-aot.ts'
},
output : {
filename : '[name].js',
path : path.resolve(__dirname,'../dist/aot')
},
module: {
rules: [
{
test : /third_party.*?\.js$|worker\.js|worker-\w+\.js/,
use : {
loader : 'file-loader',
options: {
name : '[name].[ext]'
}
}
},
{
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
loader: '@ngtools/webpack',
exclude : /third_party|plugin_example|spec\.ts|test\.ts/
},
{
test : /\.(html|css)$/,
exclude : /export\_nehuba|index|res\/css|plugin_example|material\/prebuilt-themes/,
use : {
loader : 'raw-loader',
}
},
{
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
})
],
resolve : {
extensions : [
'.ts',
'.js',
'.json'
],
alias : {
"third_party" : path.resolve(__dirname, '../third_party'),
"src" : path.resolve(__dirname, '../src')
}
}
}
module.exports = merge(staticAssets, commonAot)
\ No newline at end of file
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')
const merge = require('webpack-merge') const merge = require('webpack-merge')
const staticAssets = require('./webpack.staticassets') const aotCommon = require('./webpack.aot-common')
const TerserPlugin = require('terser-webpack-plugin')
const webpack = require('webpack')
module.exports = merge(staticAssets, { module.exports = merge(aotCommon, {
mode: 'production', mode: 'production',
entry : { })
main : './src/main-aot.ts'
},
output : {
filename : '[name].js',
path : path.resolve(__dirname,'../dist/aot')
},
module: {
rules: [
{
test : /third_party.*?\.js$|worker\.js|worker-\w+\.js/,
use : {
loader : 'file-loader',
options: {
name : '[name].[ext]'
}
}
},
{
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
loader: '@ngtools/webpack',
exclude : /third_party|plugin_example|spec\.ts$/
},
{
test : /\.(html|css)$/,
exclude : /export\_nehuba|index|res\/css|plugin_example|material\/prebuilt-themes/,
use : {
loader : 'raw-loader',
}
},
{
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
})
],
optimization: {
minimizer: [
new TerserPlugin({
extractComments: false
})
]
},
resolve : {
extensions : [
'.ts',
'.js',
'.json'
],
alias : {
"third_party" : path.resolve(__dirname,'../third_party'),
"src" : path.resolve(__dirname,'../src')
}
}
})
\ No newline at end of file
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')
const merge = require('webpack-merge') const merge = require('webpack-merge')
const staticAssets = require('./webpack.staticassets') const aotCommon = require('./webpack.aot-common')
const TerserPlugin = require('terser-webpack-plugin')
const webpack = require('webpack')
module.exports = merge(staticAssets, { module.exports = merge(aotCommon, {
mode: 'development', mode: 'development',
entry : {
main : './src/main-aot.ts'
},
output : {
filename : '[name].js',
path : path.resolve(__dirname,'../dist/aot')
},
devtool:'source-map', devtool:'source-map',
module: {
rules: [
{
test : /third_party.*?\.js$|worker\.js|worker-\w+\.js/,
use : {
loader : 'file-loader',
options: {
name : '[name].[ext]'
}
}
},
{
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
loader: '@ngtools/webpack',
exclude : /third_party|plugin_example/
},
{
test : /\.(html|css)$/,
exclude : /export\_nehuba|index|res\/css|plugin_example|material\/prebuilt-themes/,
use : {
loader : 'raw-loader',
}
},
{
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
})
],
resolve : {
extensions : [
'.ts',
'.js',
'.json'
],
alias : {
"third_party" : path.resolve(__dirname, '../third_party'),
"src" : path.resolve(__dirname, '../src')
}
}
}) })
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment