Skip to content

Commit

Permalink
feat: 修正 服务器端 public Path
Browse files Browse the repository at this point in the history
  • Loading branch information
imsunhao committed Sep 23, 2019
1 parent 234794c commit a2ba473
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,14 @@ export function serverRender(app: Express) {
)
)

const publicPath = (config.injectContext ? config.injectContext.STATIC_HOST : '') || config.webpack.client.output.publicPath
const STATIC_HOST = config.injectContext ? config.injectContext.STATIC_HOST : ''
const env = ['SERVER_ENV', 'PUBLIC_PATH'].reduce(function(obj, key) {
obj[key] = process.env[key]
return obj
}, {} as any)

const publicPath = env.SERVER_ENV !== 'local' ? STATIC_HOST + env.PUBLIC_PATH : env.PUBLIC_PATH

if (!publicPath) {
consola.fatal('[serverRender] publicPath is undefined')
return process.exit(1)
Expand Down

0 comments on commit a2ba473

Please sign in to comment.