Skip to content

Commit

Permalink
feat: DLL 更新 dev模式下不应该重启
Browse files Browse the repository at this point in the history
  • Loading branch information
孙颢 committed Jan 16, 2019
1 parent bd28ef1 commit d35db44
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export function serverDevRender(app: Express) {
const templatePath = config.render
? config.render.options.templatePath
: ''
const clientManifest: any = renderOptions.clientManifest
const clientManifest: any = clientManifestAddDll(
renderOptions.clientManifest
)
render = getRender(
createBundleRenderer(renderOptions.bundle, {
...(BASE_RENDER_OPTIONS as any),
Expand All @@ -78,10 +80,8 @@ export function serverDevRender(app: Express) {
stats.warnings.forEach((err: any) => consola.info(err))
if (stats.errors.length) return

renderOptions.clientManifest = clientManifestAddDll(
JSON.parse(
readFile(devMiddleware.fileSystem, 'vue-ssr-client-manifest.json')
)
renderOptions.clientManifest = JSON.parse(
readFile(devMiddleware.fileSystem, 'vue-ssr-client-manifest.json')
)
update('clientManifest')
}
Expand Down Expand Up @@ -131,13 +131,17 @@ export function serverDevRender(app: Express) {
}

function clientManifestAddDll(clientManifest: any) {
clientManifest = JSON.parse(JSON.stringify(clientManifest))
const config = getConfig()
if (config.webpack && config.webpack.client && config.webpack.client.output)
if (config.webpack.dll) {
try {
const dllManifest = JSON.parse(
readFileSync(
path.resolve(config.webpack.dll.path, './vue-ssr-dll-manifest.json'),
path.resolve(
config.webpack.dll.path,
'./vue-ssr-dll-manifest.json'
),
'utf-8'
)
)
Expand Down

0 comments on commit d35db44

Please sign in to comment.