We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 788a183 commit 951ec02Copy full SHA for 951ec02
packages/vite/src/node/build.ts
@@ -1338,6 +1338,13 @@ const relativeUrlMechanisms: Record<
1338
1339
const customRelativeUrlMechanisms = {
1340
...relativeUrlMechanisms,
1341
+ // override amd to use module.uri instead of document.baseURI
1342
+ amd: (relativePath) => {
1343
+ if (relativePath[0] !== '.') relativePath = './' + relativePath
1344
+ return getResolveUrl(
1345
+ `require.toUrl('${escapeId(relativePath)}'), ((typeof module !== 'undefined' && module?.id) ? require.toUrl(module.id) : document.baseURI)`,
1346
+ )
1347
+ },
1348
'worker-iife': (relativePath) =>
1349
getResolveUrl(
1350
`'${escapeId(partialEncodeURIPath(relativePath))}', self.location.href`,
0 commit comments