Skip to content

Commit

Permalink
fix(ssr): render not work in dev (#6165)
Browse files Browse the repository at this point in the history
* fix(ssr): render not work in dev

* chore: comment

* fix: ssr

* chore: writeToDisk
  • Loading branch information
ycjcl868 authored Feb 23, 2021
1 parent c57e10f commit bede27c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/bundler-webpack/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ class Bundler {
bundleImplementor?: typeof defaultWebpack;
}): IServerOpts {
const compiler = bundleImplementor(bundleConfigs);
const { devServer } = this.config;
const { ssr, devServer } = this.config;
// 这里不做 winPath 处理,是为了和下方的 path.sep 匹配上
// @ts-ignore
const compilerMiddleware = webpackDevMiddleware(compiler, {
// must be /, otherwise it will exec next()
publicPath: '/',
logLevel: 'silent',
// if `ssr` set false, next() into server-side render
...(ssr ? { index: false } : {}),
writeToDisk: devServer && devServer?.writeToDisk,
watchOptions: {
// not watch outputPath dir and node_modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function (api: IApi) {

api.modifyBundleConfig((bundleConfig, { env, type, bundler: { id } }) => {
const enableWriteToDisk =
api.config.devServer && api.config.devServer?.writeToDisk;
api.config.devServer && api.config.devServer.writeToDisk;
if (
(env === 'production' || enableWriteToDisk) &&
id === 'webpack' &&
Expand Down

0 comments on commit bede27c

Please sign in to comment.