diff --git a/.changeset/shy-singers-hide.md b/.changeset/shy-singers-hide.md new file mode 100644 index 00000000..6658f542 --- /dev/null +++ b/.changeset/shy-singers-hide.md @@ -0,0 +1,5 @@ +--- +'microbundle': patch +--- + +Ensures JS format is not included in CSS filename output diff --git a/src/index.js b/src/index.js index 3a5ea8d9..30244f05 100644 --- a/src/index.js +++ b/src/index.js @@ -457,7 +457,12 @@ function createConfig(options, entry, format, writeMeta) { modules: cssModulesConfig(options), // only write out CSS for the first bundle (avoids pointless extra files): inject: false, - extract: options.css !== 'inline', + extract: + options.css !== 'inline' && + options.output.replace( + /(\.(umd|cjs|es|m))?\.(mjs|[tj]sx?)$/, + '.css', + ), minimize: options.compress, sourceMap: options.sourcemap && options.css !== 'inline', }),