feat(cli): generate document title

This commit is contained in:
陈嘉涵
2019-11-19 17:39:38 +08:00
parent 2782aedd92
commit 4588df560c
5 changed files with 38 additions and 3 deletions

View File

@@ -1,9 +1,14 @@
import { join } from 'path';
import merge from 'webpack-merge';
import config from './webpack.base';
import baseConfig from './webpack.base';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { CONFIG_FILE } from '../common/constant';
module.exports = merge(config, {
// eslint-disable-next-line
const config = require(CONFIG_FILE);
const title = `${config.title} - ${config.description}`;
module.exports = merge(baseConfig, {
entry: {
'site-desktop': join(__dirname, '../../site/desktop/main.js'),
'site-mobile': join(__dirname, '../../site/mobile/main.js')
@@ -33,11 +38,15 @@ module.exports = merge(config, {
},
plugins: [
new HtmlWebpackPlugin({
title,
logo: config.logo,
chunks: ['chunks', 'site-desktop'],
template: join(__dirname, '../../site/desktop/index.html'),
filename: 'index.html'
}),
new HtmlWebpackPlugin({
title,
logo: config.logo,
chunks: ['chunks', 'site-mobile'],
template: join(__dirname, '../../site/mobile/index.html'),
filename: 'mobile.html'