fix(cli): always use '/' as publicPath in dev mode

This commit is contained in:
陈嘉涵 2019-12-02 16:17:24 +08:00
parent cd552dd0a6
commit 3d8f3c36aa
2 changed files with 8 additions and 2 deletions

View File

@ -99,4 +99,8 @@ export function setNodeEnv(value: NodeEnv) {
process.env.NODE_ENV = value;
}
export function isDev() {
return process.env.NODE_ENV === 'development';
}
export { decamelize };

View File

@ -1,11 +1,13 @@
import merge from 'webpack-merge';
import { get } from 'lodash';
import { getWebpackConfig } from '../common';
import { isDev, 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);
const publicPath = get(CONFIG, 'build.site.publicPath', '/');
// always use '/' as publicPath in dev mode
const publicPath = isDev() ? '/' : get(CONFIG, 'build.site.publicPath', '/');
export const sitePrdConfig = merge(
siteDevBaseConfig,