Visualizer = require('webpack-visualizer-plugin');
const ngcWebpack = require('ngc-webpack');
const path = require('path');
const utils = require('./utils.js');
const commonConfig = require('./webpack.common.js');
const ENV = 'production';
const extractSASS = new ExtractTextPlugin(`[name]-sass.[hash].css`);
const extractCSS = new ExtractTextPlugin(`[name].[hash].css`);
module.exports = webpackMerge(commonConfig({ env: ENV }), {
// devtool: 'source-map', // Enable source maps. Please note that this will slow down the build
entry: {
polyfills: './src/main/webapp/app/polyfills',
global: ['./src/main/webapp/content/scss/global.scss', './src/main/webapp/content/scss/app.scss'],
main: './src/main/webapp/app/app.main-aot'
},
output: {
path: utils.root('build/www'),
filename: 'app/[name].[hash].bundle.js',
chunkFilename: 'app/[id].[hash].chunk.js'
},
module: {
rules: [{
test: /\.ts$/,
use: [
{ loader: 'angular2-template-loader' },
{
loader: 'awesome-typescript-loader',
options: {
configFileName: 'tsconfig-aot.json'
},
}
],
exclude: ['node_modules/generator-jhipster']
},
{
test: /\.scss$/,
loaders: ['to-string-loader', 'css-loader', 'sass-loader'],
exclude: /(vendor\.scss|global\.scss)/
},
{
test: /(vendor\.scss|global\.scss)/,
use: extractSASS.extract({
fallback: 'style-loader',
use: ['css-loader', 'postcss-loader', 'sass-loader']
})
},
{
test: /\.css$/,
loaders: ['to-string-loader', 'css-loader'],
exclude: /(vendor\.css|global\.css)/
},
{
test: /(vendor\.css|global\.css)/,
use: extractCSS.extract({
fallback: 'style-loader',
use: ['css-loader']
})
}]
},
plugins: [
extractSASS,
extractCSS,
new webpack.optimize.UglifyJsPlugin({
beautify: false,
comments: false,
compress: {
screw_ie8: true,
warnings: false
},
mangle: {
keep_fnames: true,
screw_i8: true
}
}),
new ngcWebpack.NgcWebpackPlugin({
disabled: false,
tsConfig: utils.root('tsconfig-aot.json'),
resourceOverride: ''
}),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
})
]
});что не так?
как можно оптимизировать?
Обсуждают сегодня