Merge pull request #122 from gconsidine/ui/move-install-template-to-prod-build

Move install.template.ejs to be built for prod only
This commit is contained in:
Matthew Jones 2017-09-11 14:46:57 -07:00 committed by GitHub
commit 6dbbd7d605
2 changed files with 22 additions and 16 deletions

View File

@ -25,8 +25,6 @@ const APP_ENTRY = path.join(SOURCE_PATH, 'app.js');
const VENDOR_ENTRY = path.join(SOURCE_PATH, 'vendor.js');
const INDEX_ENTRY = path.join(CLIENT_PATH, 'index.template.ejs');
const INDEX_OUTPUT = path.join(UI_PATH, 'templates/ui/index.html');
const INSTALL_RUNNING_ENTRY = path.join(CLIENT_PATH, 'installing.template.ejs')
const INSTALL_RUNNING_OUTPUT = path.join(UI_PATH, 'templates/ui/installing.html');
const THEME_ENTRY = path.join(LIB_PATH, 'theme', 'index.less');
const OUTPUT = 'js/[name].[hash].js';
const CHUNKS = ['vendor', 'app'];
@ -170,19 +168,6 @@ let base = {
moduleA.files.sort((fileA, fileB) => fileA.includes('js') ? -1 : 1)
moduleB.files.sort((fileA, fileB) => fileA.includes('js') ? -1 : 1)
return moduleA.names[0] === 'vendor' ? -1 : 1
}
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
template: INSTALL_RUNNING_ENTRY,
filename: INSTALL_RUNNING_OUTPUT,
inject: false,
chunks: CHUNKS,
chunksSortMode: (moduleA, moduleB) => {
moduleA.files.sort((fileA, fileB) => fileA.includes('js') ? -1 : 1)
moduleB.files.sort((fileA, fileB) => fileA.includes('js') ? -1 : 1)
return moduleA.names[0] === 'vendor' ? -1 : 1
}
})

View File

@ -1,15 +1,36 @@
const _ = require('lodash');
const path = require('path');
const _ = require('lodash');
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
let base = require('./webpack.base');
const CLIENT_PATH = path.resolve(__dirname, '../client');
const UI_PATH = path.resolve(__dirname, '..');
const INSTALL_RUNNING_ENTRY = path.join(CLIENT_PATH, 'installing.template.ejs')
const INSTALL_RUNNING_OUTPUT = path.join(UI_PATH, 'templates/ui/installing.html');
const CHUNKS = ['vendor', 'app'];
let production = {
plugins: [
new UglifyJSPlugin({
compress: true,
mangle: false
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
template: INSTALL_RUNNING_ENTRY,
filename: INSTALL_RUNNING_OUTPUT,
inject: false,
chunks: CHUNKS,
chunksSortMode: (moduleA, moduleB) => {
moduleA.files.sort((fileA, fileB) => fileA.includes('js') ? -1 : 1);
moduleB.files.sort((fileA, fileB) => fileA.includes('js') ? -1 : 1);
return moduleA.names[0] === 'vendor' ? -1 : 1;
}
})
]
};