Skip to content

Commit

Permalink
fix: update output.publicPath
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuang committed Jan 12, 2021
1 parent 008c53d commit ef97d07
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/webpack/src/config/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const generateAnalysis = Boolean(process.env.GENERATE_ANALYSIS)
const getClientWebpack = (argv: Argv) => {
// @ts-expect-error
const { funcName } = argv.faasRoutes[0]
const truePublicPath = isDev ? publicPath : `/${funcName}/client${publicPath}`
const config = getBaseConfig()
config.devtool(isDev ? 'cheap-module-source-map' : (shouldUseSourceMap ? 'source-map' : false))

Expand All @@ -24,7 +25,7 @@ const getClientWebpack = (argv: Argv) => {
.path(getOutput(funcName).clientOutPut)
.filename(useHash ? 'static/js/[name].[contenthash:8].js' : 'static/js/[name].js')
.chunkFilename(useHash ? 'static/js/[name].[contenthash:8].chunk.js' : 'static/js/[name].chunk.js')
.publicPath(publicPath)
.publicPath(truePublicPath)
.end()

config.optimization
Expand Down Expand Up @@ -91,7 +92,7 @@ const getClientWebpack = (argv: Argv) => {

config.plugin('manifest').use(loadModule('webpack-manifest-plugin'), [{
fileName: 'asset-manifest.json',
publicPath: isDev ? publicPath : `/${funcName}/client${publicPath}`
publicPath: truePublicPath
}])

config.when(generateAnalysis, config => {
Expand Down

0 comments on commit ef97d07

Please sign in to comment.