Skip to content

Commit fe897b2

Browse files
authored
fix: ensure filename for esm format (#364)
1 parent 4aae8f0 commit fe897b2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -457,12 +457,16 @@ export class Bundler {
457457
typeof getFileName === 'function'
458458
? getFileName({ format: rollupFormat, minify }, defaultFileName)
459459
: getFileName
460-
const fileName = fileNameTemplate
460+
let fileName = fileNameTemplate
461461
.replace(/\[min\]/, minPlaceholder)
462462
// The `[ext]` placeholder no longer makes sense
463463
// Since we only output to `.js` now
464464
// Probably remove it in the future
465465
.replace(/\[ext\]/, '.js')
466+
467+
if (rollupFormat === 'esm') {
468+
fileName = fileName.replace(/\[format\]/, 'esm')
469+
}
466470

467471
return {
468472
inputConfig: {

0 commit comments

Comments
 (0)