Skip to content

Commit

Permalink
fix: dev环境构建SSR server.js时,环境判断错误导致输出的dev产物带上了hash (#11709)
Browse files Browse the repository at this point in the history
* fix: dev环境构建SSR server.js时,环境判断错误导致输出的dev产物带上了hash

* Update packages/preset-umi/src/features/ssr/webpack/webpack.ts

Co-authored-by: chencheng (云谦) <[email protected]>

* fix: dev环境构建SSR server.js时,环境判断错误导致输出的dev产物带上了hash

---------

Co-authored-by: 奇风 <[email protected]>
Co-authored-by: chencheng (云谦) <[email protected]>
  • Loading branch information
3 people authored Oct 9, 2023
1 parent 37737e7 commit fb0a75f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/preset-umi/src/features/ssr/webpack/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ export const build = async (api: IApi, opts: any) => {
const now = new Date().getTime();
const bundlerOpts: any = lodash.cloneDeep(opts);
const oChainWebpack = bundlerOpts.chainWebpack;
const isDev = opts.env === Env.development;
const { userConfig, config } = opts;
const useHash = (config.hash || (userConfig?.hash && !isDev));
const useHash = api.config.hash && api.env === Env.production;
// disable deadCode check
delete bundlerOpts.config.deadCode;

Expand Down Expand Up @@ -49,7 +47,9 @@ export const build = async (api: IApi, opts: any) => {
memo.output
.path(dirname(absOutputFile))
.filename(useHash ? 'umi.[contenthash:8].server.js' : 'umi.server.js')
.chunkFilename(useHash ? 'umi.[contenthash:8].server.js' : 'umi.server.js')
.chunkFilename(
useHash ? 'umi.[contenthash:8].server.js' : 'umi.server.js',
)
.libraryTarget('commonjs2');

// remove useless progress plugin
Expand Down

0 comments on commit fb0a75f

Please sign in to comment.