Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/nextjs/src/config/loaders/prefixLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function prefixLoader(this: LoaderThis<LoaderOptions>, userCode:

// Fill in the placeholder
let templateCode = fs.readFileSync(templatePath).toString();
templateCode = templateCode.replace('__DIST_DIR__', distDir);
templateCode = templateCode.replace('__DIST_DIR__', distDir.replace(/\\/g, '\\\\'));

return `${templateCode}\n${userCode}`;
}
6 changes: 3 additions & 3 deletions packages/nextjs/src/config/loaders/proxyLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default async function proxyLoader(this: LoaderThis<LoaderOptions>, userC
: 'pageProxyLoaderTemplate.js';
const templatePath = path.resolve(__dirname, `../templates/${templateFile}`);
let templateCode = fs.readFileSync(templatePath).toString();
// Make sure the template is included when runing `webpack watch`
// Make sure the template is included when running `webpack watch`
this.addDependency(templatePath);

// Inject the route and the path to the file we're wrapping into the template
templateCode = templateCode.replace(/__ROUTE__/g, parameterizedRoute);
templateCode = templateCode.replace(/__RESOURCE_PATH__/g, this.resourcePath);
templateCode = templateCode.replace(/__ROUTE__/g, parameterizedRoute.replace(/\\/g, '\\\\'));
templateCode = templateCode.replace(/__RESOURCE_PATH__/g, this.resourcePath.replace(/\\/g, '\\\\'));

// Run the proxy module code through Rollup, in order to split the `export * from '<wrapped file>'` out into
// individual exports (which nextjs seems to require).
Expand Down