fix(cli): publicPath config

This commit is contained in:
陈嘉涵 2019-12-03 11:52:20 +08:00
parent 41db946d87
commit e98e4e7ced
3 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,10 @@ export default {
data() {
const { site } = config.build || {};
const publicPath = (site && site.publicPath) || '/';
const isProd = process.env.NODE_ENV === 'production';
const prodPublicPath = (site && site.publicPath) || '/';
const publicPath = isProd ? prodPublicPath : '/';
return {
config: config.site,
simulator: `${publicPath}mobile.html${location.hash}`

View File

@ -30,8 +30,6 @@ export const siteDevBaseConfig = merge(baseConfig as any, {
}
},
output: {
path: join(__dirname, '../../site/dist'),
publicPath: '/',
chunkFilename: 'async_[name].js'
},
optimization: {

View File

@ -1,13 +1,12 @@
import merge from 'webpack-merge';
import { get } from 'lodash';
import { isDev, getWebpackConfig } from '../common';
import { getWebpackConfig } from '../common';
import { siteDevBaseConfig } from './webpack.site.dev';
import { CONFIG, SITE_DIST_DIR } from '../common/constant';
const outputDir = get(CONFIG, 'build.site.outputDir', SITE_DIST_DIR);
// always use '/' as publicPath in dev mode
const publicPath = isDev() ? '/' : get(CONFIG, 'build.site.publicPath', '/');
const publicPath = get(CONFIG, 'build.site.publicPath', '/');
export const sitePrdConfig = merge(
siteDevBaseConfig,