mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
* vendor libraries * vendor libraries settings * additional vendor libs settings * production settings for i18n * fix pdfs and favicon paths * readme update * code cleanup
88 lines
2.6 KiB
JavaScript
88 lines
2.6 KiB
JavaScript
var webpack = require('webpack');
|
|
var webpackMerge = require('webpack-merge');
|
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
var CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
var commonConfig = require('./webpack.common.js');
|
|
var helpers = require('./helpers');
|
|
|
|
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
|
|
|
|
module.exports = webpackMerge(commonConfig, {
|
|
devtool: 'source-map',
|
|
|
|
output: {
|
|
path: helpers.root('dist'),
|
|
publicPath: '/',
|
|
filename: '[name].[hash].js',
|
|
chunkFilename: '[id].[hash].chunk.js'
|
|
},
|
|
|
|
htmlLoader: {
|
|
minimize: false // workaround for ng2
|
|
},
|
|
|
|
plugins: [
|
|
// Define env variables to help with builds
|
|
// Reference: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
|
|
new webpack.DefinePlugin({
|
|
'process.env': {
|
|
'ENV': JSON.stringify(ENV)
|
|
}
|
|
}),
|
|
|
|
// Reference: http://webpack.github.io/docs/list-of-plugins.html#noerrorsplugin
|
|
// Only emit files when there are no errors
|
|
new webpack.NoErrorsPlugin(),
|
|
|
|
// Reference: http://webpack.github.io/docs/list-of-plugins.html#dedupeplugin
|
|
// Dedupe modules in the output
|
|
new webpack.optimize.DedupePlugin(),
|
|
|
|
// Reference: http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
|
|
// Minify all javascript, switch loaders to minimizing mode
|
|
new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
|
|
mangle: {
|
|
keep_fnames: true
|
|
},
|
|
compressor: {
|
|
screw_ie8: true,
|
|
warnings: false
|
|
}
|
|
}),
|
|
|
|
// Extract css files
|
|
// Reference: https://github.com/webpack/extract-text-webpack-plugin
|
|
// Disabled when in test mode or not in build mode
|
|
new ExtractTextPlugin('[name].[hash].css'),
|
|
|
|
// Copy assets from the public folder
|
|
// Reference: https://github.com/kevlened/copy-webpack-plugin
|
|
new CopyWebpackPlugin([
|
|
{
|
|
from: 'favicon-96x96.png'
|
|
},
|
|
{
|
|
from: 'node_modules/pdfjs-dist/build/pdf.worker.js',
|
|
to: 'pdf.worker.js'
|
|
},
|
|
{
|
|
context: 'custom-translation',
|
|
from: '**/*.json',
|
|
to: 'i18n/custom-translation'
|
|
},
|
|
// Copy i18n folders for all modules with ng2-alfresco- prefix
|
|
{
|
|
context: 'node_modules',
|
|
from: 'ng2-alfresco-*/dist/src/i18n/*.json',
|
|
to: 'node_modules'
|
|
},
|
|
// Copy i18n folders for all modules with ng2-activiti- prefix
|
|
{
|
|
context: 'node_modules',
|
|
from: 'ng2-activiti-*/dist/src/i18n/*.json',
|
|
to: 'node_modules'
|
|
}
|
|
])
|
|
]
|
|
});
|