mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -05:00
Refactor webpack production config
This commit is contained in:
parent
e427709042
commit
03772fe887
1 changed files with 3 additions and 71 deletions
|
@ -1,77 +1,9 @@
|
||||||
var baseConfig = require('./webpackBaseConfig');
|
var baseConfig = require('./webpackBaseConfig');
|
||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
||||||
|
|
||||||
module.exports = Object.assign({}, baseConfig, {
|
module.exports = Object.assign({}, baseConfig, {
|
||||||
plugins: [
|
plugins: baseConfig.plugins.concat([
|
||||||
new webpack.ProvidePlugin({
|
|
||||||
Visibility: "visibilityjs",
|
|
||||||
Cookies: "js-cookie",
|
|
||||||
key: "keymaster",
|
|
||||||
$: "jquery",
|
|
||||||
jQuery: "jquery",
|
|
||||||
"window.jQuery": "jquery",
|
|
||||||
"moment": "moment",
|
|
||||||
"Handlebars": "handlebars"
|
|
||||||
}),
|
|
||||||
new ExtractTextPlugin("[name].css"),
|
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
|
||||||
names: ["cover", "index", "pretty", "slide", "vendor"],
|
|
||||||
children: true,
|
|
||||||
async: true,
|
|
||||||
filename: '[name].js',
|
|
||||||
minChunks: Infinity
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: 'public/views/includes/header.ejs',
|
|
||||||
chunks: ['vendor', 'index'],
|
|
||||||
filename: path.join(__dirname, 'public/views/build/index-header.ejs'),
|
|
||||||
inject: false
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: 'public/views/includes/scripts.ejs',
|
|
||||||
chunks: ['vendor', 'index'],
|
|
||||||
filename: path.join(__dirname, 'public/views/build/index-scripts.ejs'),
|
|
||||||
inject: false
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: 'public/views/includes/header.ejs',
|
|
||||||
chunks: ['vendor', 'cover'],
|
|
||||||
filename: path.join(__dirname, 'public/views/build/cover-header.ejs'),
|
|
||||||
inject: false
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: 'public/views/includes/scripts.ejs',
|
|
||||||
chunks: ['vendor', 'cover'],
|
|
||||||
filename: path.join(__dirname, 'public/views/build/cover-scripts.ejs'),
|
|
||||||
inject: false
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: 'public/views/includes/header.ejs',
|
|
||||||
chunks: ['vendor', 'pretty'],
|
|
||||||
filename: path.join(__dirname, 'public/views/build/pretty-header.ejs'),
|
|
||||||
inject: false
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: 'public/views/includes/scripts.ejs',
|
|
||||||
chunks: ['vendor', 'pretty'],
|
|
||||||
filename: path.join(__dirname, 'public/views/build/pretty-scripts.ejs'),
|
|
||||||
inject: false
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: 'public/views/includes/header.ejs',
|
|
||||||
chunks: ['vendor', 'slide'],
|
|
||||||
filename: path.join(__dirname, 'public/views/build/slide-header.ejs'),
|
|
||||||
inject: false
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: 'public/views/includes/scripts.ejs',
|
|
||||||
chunks: ['vendor', 'slide'],
|
|
||||||
filename: path.join(__dirname, 'public/views/build/slide-scripts.ejs'),
|
|
||||||
inject: false
|
|
||||||
}),
|
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
'NODE_ENV': JSON.stringify('production')
|
'NODE_ENV': JSON.stringify('production')
|
||||||
|
@ -84,11 +16,11 @@ module.exports = Object.assign({}, baseConfig, {
|
||||||
mangle: false,
|
mangle: false,
|
||||||
sourceMap: false
|
sourceMap: false
|
||||||
})
|
})
|
||||||
],
|
]),
|
||||||
|
|
||||||
output: {
|
output: {
|
||||||
path: path.join(__dirname, 'public/build'),
|
path: path.join(__dirname, 'public/build'),
|
||||||
publicPath: '/build/',
|
publicPath: '/build/',
|
||||||
filename: '[id].[name].[hash].js'
|
filename: '[id].[name].[hash].js'
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue