Skip to content

Commit 19a3f95

Browse files
mvorisekfreddy38510
authored andcommitted
fix: keep build stable when run in a different path (vuejs#2040)
By making the `exportHelperPath` a relative path so that the generated code is consistent.
1 parent 9a73fe3 commit 19a3f95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export interface VueLoaderOptions {
6060
let errorEmitted = false
6161

6262
const { parse } = compiler
63-
const exportHelperPath = JSON.stringify(require.resolve('./exportHelper'))
63+
const exportHelperPath = require.resolve('./exportHelper')
6464

6565
export default function loader(
6666
this: LoaderContext<VueLoaderOptions>,
@@ -332,7 +332,7 @@ export default function loader(
332332
if (!propsToAttach.length) {
333333
code += `\n\nconst __exports__ = script;`
334334
} else {
335-
code += `\n\nimport exportComponent from ${exportHelperPath}`
335+
code += `\n\nimport exportComponent from ${stringifyRequest(exportHelperPath)}`
336336
code += `\nconst __exports__ = /*#__PURE__*/exportComponent(script, [${propsToAttach
337337
.map(([key, val]) => `['${key}',${val}]`)
338338
.join(',')}])`

0 commit comments

Comments
 (0)