Skip to content

Commit

Permalink
fix: keep build stable when run in a different path (#2040)
Browse files Browse the repository at this point in the history
By making the `exportHelperPath` a relative path so that the generated code is consistent.
  • Loading branch information
mvorisek authored May 28, 2023
1 parent b96af78 commit a81dc0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface VueLoaderOptions {
let errorEmitted = false

const { parse } = compiler
const exportHelperPath = JSON.stringify(require.resolve('./exportHelper'))
const exportHelperPath = require.resolve('./exportHelper')

export default function loader(
this: LoaderContext<VueLoaderOptions>,
Expand Down Expand Up @@ -296,7 +296,7 @@ export default function loader(
if (!propsToAttach.length) {
code += `\n\nconst __exports__ = script;`
} else {
code += `\n\nimport exportComponent from ${exportHelperPath}`
code += `\n\nimport exportComponent from ${stringifyRequest(exportHelperPath)}`
code += `\nconst __exports__ = /*#__PURE__*/exportComponent(script, [${propsToAttach
.map(([key, val]) => `['${key}',${val}]`)
.join(',')}])`
Expand Down

0 comments on commit a81dc0f

Please sign in to comment.