fix(v2): escape import path on windows (#2099)

This commit is contained in:
Endi 2019-12-07 09:52:23 +07:00 committed by GitHub
parent e62a93863f
commit 5c39041dc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,7 +91,10 @@ export async function loadRoutes(pluginsRouteConfigs: RouteConfig[]) {
if (isModule(value)) {
const modulePath = getModulePath(value);
const chunkName = genChunkName(modulePath, prefix, name);
const loader = `() => import(/* webpackChunkName: '${chunkName}' */ "${modulePath}")`;
// We need to JSON.stringify so that if its on windows, backslash are escaped.
const loader = `() => import(/* webpackChunkName: '${chunkName}' */ ${JSON.stringify(
modulePath,
)})`;
registry[chunkName] = {
loader,