Skip to content

Commit 011eda5

Browse files
committed
Fix for multiple rollup output formats
1 parent 48df453 commit 011eda5

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = function workerLoaderPlugin(userConfig = null) {
4141
options: null,
4242
basePath: null,
4343
forceInlineCounter: 0,
44-
configuredFileName: null,
44+
configuredFileNames: new Map(),
4545
};
4646

4747
return {

src/plugin/generateBundle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function generateBundle(state, config, options, bundle, isWrite) {
22
if (!config.inline && isWrite) {
3-
if (state.configuredFileName && Object.keys(bundle).length === 1) {
4-
bundle[Object.keys(bundle)[0]].fileName = state.configuredFileName;
3+
if (state.configuredFileNames.size > 0 && Object.keys(bundle).length === 1) {
4+
bundle[Object.keys(bundle)[0]].fileName = state.configuredFileNames.get(options.format);
55
}
66
for (const worker of state.idMap) {
77
if (worker[1].chunk && !bundle[worker[1].workerID]) {

src/plugin/outputOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const path = require('path');
22

33
function outputOptions(state, config, options) {
44
if (!config.inline && options.file && !options.dir) {
5-
state.configuredFileName = path.basename(options.file);
5+
state.configuredFileNames.set(options.format, path.basename(options.file));
66
return Object.assign({}, options, {
77
file: null,
88
dir: path.dirname(options.file),

0 commit comments

Comments
 (0)