Skip to content

Commit 70a9047

Browse files
author
Loïc Mangeonjean
committed
fix: help rollup resolving file urls
default behavior is wrong for files in the same directory
1 parent 23e5ef1 commit 70a9047

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

rollup/rollup.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,16 @@ export default (args: Record<string, string>): rollup.RollupOptions[] => {
592592
return code.replaceAll("'./keyboardLayouts/layout.contribution.' + platform", "'./keyboardLayouts/layout.contribution.' + platform + '.js'")
593593
}
594594
},
595+
{
596+
name: 'resolve-asset-url',
597+
resolveFileUrl (options) {
598+
let relativePath = options.relativePath
599+
if (!relativePath.startsWith('.')) {
600+
relativePath = `./${options.relativePath}`
601+
}
602+
return `'${relativePath}'`
603+
}
604+
},
595605
nodeResolve({
596606
extensions: EXTENSIONS
597607
}),

rollup/rollup.default-extensions.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ export default rollup.defineConfig(defaultExtensions.map(name => (<rollup.Rollup
4343
return undefined
4444
}
4545
},
46+
{
47+
name: 'resolve-asset-url',
48+
resolveFileUrl (options) {
49+
let relativePath = options.relativePath
50+
if (!relativePath.startsWith('.')) {
51+
relativePath = `./${options.relativePath}`
52+
}
53+
return `'${relativePath}'`
54+
}
55+
},
4656
nodeResolve({
4757
extensions: EXTENSIONS
4858
}),

0 commit comments

Comments
 (0)