Skip to content

Instantly share code, notes, and snippets.

@iivankin
Created February 25, 2022 16:41
Show Gist options
  • Save iivankin/61027542406a71e0ea5434593d8ebec1 to your computer and use it in GitHub Desktop.
Save iivankin/61027542406a71e0ea5434593d8ebec1 to your computer and use it in GitHub Desktop.
diff --git a/dist/build/index.js b/dist/build/index.js
index e7c02dfe9be53e991d8e915dede71e100aff617c..f68136e94c9ab7935795772ff583be889360500f 100644
--- a/dist/build/index.js
+++ b/dist/build/index.js
@@ -761,6 +761,7 @@ async function build(dir, conf = null, reactProductionProfiling = false, debugOu
], {
base: root,
processCwd: dir,
+ resolve: config.experimental.fileTraceResolve,
ignore: [
'**/next/dist/pages/**/*',
'**/next/dist/compiled/webpack/(bundle4|bundle5).js',
diff --git a/dist/build/webpack/plugins/next-trace-entrypoints-plugin.js b/dist/build/webpack/plugins/next-trace-entrypoints-plugin.js
index 9831da776885f424b4ae882d577d37c1ce069006..a80ac3c9182d6d3b688db04c7ef8985d89387a8c 100644
--- a/dist/build/webpack/plugins/next-trace-entrypoints-plugin.js
+++ b/dist/build/webpack/plugins/next-trace-entrypoints-plugin.js
@@ -56,13 +56,14 @@ function getFilesMapFromReasons(fileList, reasons, ignoreFn) {
return parentFilesMap;
}
class TraceEntryPointsPlugin {
- constructor({ appDir , excludeFiles , esmExternals , staticImageImports , outputFileTracingRoot }){
+ constructor({ appDir , excludeFiles , esmExternals , staticImageImports , outputFileTracingRoot, fileTraceResolve }){
this.appDir = appDir;
this.entryTraces = new Map();
this.esmExternals = esmExternals;
this.excludeFiles = excludeFiles || [];
this.staticImageImports = staticImageImports;
this.tracingRoot = outputFileTracingRoot || appDir;
+ this.fileTraceResolve = fileTraceResolve;
}
// Here we output all traced assets and webpack chunks to a
// ${page}.js.nft.json file
@@ -92,6 +93,7 @@ class TraceEntryPointsPlugin {
], {
base: this.tracingRoot,
processCwd: this.appDir,
+ resolve: this.fileTraceResolve,
readFile: async (path)=>{
if (chunksToTrace.has(path)) {
var ref, ref1;
diff --git a/dist/build/webpack-config.js b/dist/build/webpack-config.js
index d6a492bdc7997c252b0d1c89e05700ca93a8d51a..14c03fd8a0521d5a6b64ca91f4df5d1363c98867 100644
--- a/dist/build/webpack-config.js
+++ b/dist/build/webpack-config.js
@@ -1115,7 +1115,8 @@ async function getBaseWebpackConfig(dir, { buildId , config , dev =false , isSer
appDir: dir,
esmExternals: config.experimental.esmExternals,
staticImageImports: !config.images.disableStaticImages,
- outputFileTracingRoot: config.experimental.outputFileTracingRoot
+ outputFileTracingRoot: config.experimental.outputFileTracingRoot,
+ fileTraceResolve: config.experimental.fileTraceResolve
}),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment