diff --git a/build/webpack/plugins/build-manifest-plugin.js b/build/webpack/plugins/build-manifest-plugin.js index f7319054..fc2c346e 100644 --- a/build/webpack/plugins/build-manifest-plugin.js +++ b/build/webpack/plugins/build-manifest-plugin.js @@ -8,14 +8,14 @@ export default class BuildManifestPlugin { apply (compiler: any) { compiler.hooks.emit.tapAsync('NextJsBuildManifest', (compilation, callback) => { const {chunks} = compilation - const assetMap = {pages: {}} + const assetMap = {devFiles: [], pages: {}} const mainJsChunk = chunks.find((c) => c.name === CLIENT_STATIC_FILES_RUNTIME_MAIN) const mainJsFiles = mainJsChunk && mainJsChunk.files.length > 0 ? mainJsChunk.files.filter((file) => /\.js$/.test(file)) : [] for (const filePath of Object.keys(compilation.assets)) { if (/^static\/dll\//.test(filePath)) { - mainJsFiles.push(filePath) + assetMap.devFiles.push(filePath) } } diff --git a/server/document.js b/server/document.js index 361bb437..7e1dcf34 100644 --- a/server/document.js +++ b/server/document.js @@ -199,11 +199,12 @@ export class NextScript extends Component { } render () { - const { staticMarkup, assetPrefix, __NEXT_DATA__ } = this.context._documentProps + const { staticMarkup, assetPrefix, devFiles, __NEXT_DATA__ } = this.context._documentProps const { page, pathname, buildId } = __NEXT_DATA__ const pagePathname = getPagePathname(pathname) return + {devFiles ? devFiles.map((file) =>