From 20e67d2d4a611194b3d73caa28b32a44431f5f22 Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 2 Feb 2023 16:39:31 +0800 Subject: [PATCH] fxxk windows --- lib/compile-vue.js | 11 +++++++---- package.json | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/compile-vue.js b/lib/compile-vue.js index 2c0d595..35ab386 100644 --- a/lib/compile-vue.js +++ b/lib/compile-vue.js @@ -142,7 +142,10 @@ export function parseJs( let tmp = `style${Date.now()}` fixedStyle += `document.adoptedStyleSheets.push(${tmp})\n` - return `import ${tmp} from '${name}' assert { type: 'css' }\n${tmp}.path = '${name}'` + return `import ${tmp} from '${name}' assert { type: 'css' }\n${tmp}.path = '${name.replace( + /\\/g, + '\\\\' + )}'` } else { if (name.startsWith('@/')) { name = name.replace('@/', '/assets/js/') @@ -213,9 +216,9 @@ export function compileVue(file, imports, options = {}, isBuild) { js += ` let stylesheet = new CSSStyleSheet() -stylesheet.path = '${file.slice( - options.IS_MPA ? options.pagesDir.length : options.root.length - )}' +stylesheet.path = '${file + .slice(options.IS_MPA ? options.pagesDir.length : options.root.length) + .replace(/\\/g, '\\\\')}' stylesheet.replaceSync(\`${CACHE[file].css}\`) document.adoptedStyleSheets.push(stylesheet) ` diff --git a/package.json b/package.json index 878862e..3e7d9b5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@bytedo/vue-live", "type": "module", - "version": "0.1.1", + "version": "0.1.2", "bin": { "vue-live": "index.js" },