Skip to content

Commit 23bc2bc

Browse files
committed
fix: resolve meta js without the suffix
fix #8
1 parent 2ddc91c commit 23bc2bc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ export default (transform?: (metadata: string) => string): Plugin => {
1212
name: 'userscript-metadata',
1313
async resolveId(source, importer, options) {
1414
if (source.endsWith(suffix)) {
15-
const { id } = await this.resolve(source, importer, options);
16-
metadataMap.set(importer, id.slice(0, -suffix.length));
15+
const sourceFile = source.slice(0, -suffix.length);
16+
const { id } = await this.resolve(sourceFile, importer, options);
17+
metadataMap.set(importer, id);
18+
return source;
1719
}
1820
},
1921
load(id) {

0 commit comments

Comments
 (0)