Skip to content

Commit 49e16b5

Browse files
committed
fix: remove metadata suffix after resolving
to avoid being handled by other plugins like plugin-commonjs
1 parent b9665a0 commit 49e16b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.ts

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

0 commit comments

Comments
 (0)