File tree 2 files changed +11
-6
lines changed
2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,12 @@ export class Bundler {
85
85
this . pkg . data = { }
86
86
}
87
87
88
+ if ( / \. m j s $ / . test ( this . pkg . data . module || this . pkg . data . main ) ) {
89
+ logger . warn (
90
+ `Bili no longer use .mjs extension for esm bundle, you should use .js instead!`
91
+ )
92
+ }
93
+
88
94
const userConfig =
89
95
options . configFile === false
90
96
? { }
@@ -411,7 +417,10 @@ export class Bundler {
411
417
: getFileName
412
418
const fileName = fileNameTemplate
413
419
. replace ( / \[ m i n \] / , minPlaceholder )
414
- . replace ( / \[ e x t \] / , / ^ e s m ? $ / . test ( rollupFormat ) ? '.mjs' : '.js' )
420
+ // The `[ext]` placeholder no longer makes sense
421
+ // Since we only output to `.js` now
422
+ // Probably remove it in the future
423
+ . replace ( / \[ e x t \] / , '.js' )
415
424
416
425
return {
417
426
inputConfig : {
@@ -678,10 +687,7 @@ async function printAssets(assets: Assets, title: string) {
678
687
}
679
688
680
689
function getDefaultFileName ( format : RollupFormat ) {
681
- const isESM = / ^ e s m ? $ / . test ( format )
682
- return format === 'cjs' || isESM
683
- ? `[name][min][ext]`
684
- : `[name].[format][min][ext]`
690
+ return format === 'cjs' ? `[name][min][ext]` : `[name].[format][min][ext]`
685
691
}
686
692
687
693
export { Config , NormalizedConfig , Options , ConfigOutput }
Original file line number Diff line number Diff line change @@ -131,7 +131,6 @@ export interface ConfigOutput {
131
131
* Placeholders:
132
132
* - `[name]`: The base name of input file. (without extension)
133
133
* - `[format]`: The output format. (without `-min` suffix)
134
- * - `[ext]`: The extension. It's `.mjs` for `esm` format, `.js` otherwise
135
134
* - `[min]`: It will replaced by `.min` when the format ends with `-min`, otherwise it's an empty string.
136
135
*
137
136
* The value can also be a function which returns the fileName template,
You can’t perform that action at this time.
0 commit comments