提交 c19fb3aa 编写于 作者: Y YuChao Liang 提交者: ULIVZ

fix: escape backslash (#787)

上级 f81f3732
function genImportAsyncComponentFile (pages) { function genImportAsyncComponentFile (pages) {
return `export function loadComponent (key) { return `export function loadComponent (key) {
switch (key) { switch (key) {
${pages.map(({ key, _filePath }) => ` case "${key}": return import("${_filePath}");`).join('\n')} ${pages.map(({ key, _filePath }) => ` case ${JSON.stringify(key)}: return import(${JSON.stringify(_filePath)});`).join('\n')}
} }
}` }`
} }
......
...@@ -51,7 +51,7 @@ module.exports = class EnhanceAppFilesOption extends Option { ...@@ -51,7 +51,7 @@ module.exports = class EnhanceAppFilesOption extends Option {
if (fs.existsSync(filePath)) { if (fs.existsSync(filePath)) {
destPath = await context.writeTemp( destPath = await context.writeTemp(
`app-enhancers/enhancer-${moduleId++}.js`, `app-enhancers/enhancer-${moduleId++}.js`,
`export { default } from '${(filePath)}'` `export { default } from ${JSON.stringify(filePath)}`
) )
} else { } else {
logger.debug( logger.debug(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册