ESM: Do not append the .js suffix to imports if it's already there

This commit is contained in:
Alex Dima 2022-01-26 09:08:30 +01:00
parent 5330724dff
commit 1134d5e82b
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
5 changed files with 56 additions and 5 deletions

View file

@ -272,7 +272,8 @@ function ESM_addImportSuffix(files) {
const pos = info.importedFiles[i].pos;
const end = info.importedFiles[i].end;
if (/\.css$/.test(importText)) {
if (/(\.css)|(\.js)$/.test(importText)) {
// A CSS import or an import already using .js
continue;
}