Skip to content

Commit

Permalink
Disable errors for duplicate emitted file names
Browse files Browse the repository at this point in the history
And add a test to make sure such emits no longer error spuriously.

Issue #3174
  • Loading branch information
marijnh committed Oct 18, 2019
1 parent d677eb7 commit 3100b4e
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/FileEmitter.ts
Expand Up @@ -10,7 +10,6 @@ import {
errAssetSourceAlreadySet,
errChunkNotGeneratedForFileName,
errFailedValidation,
errFileNameConflict,
errFileReferenceIdNotFoundForFilename,
errInvalidRollupPhaseForChunkEmission,
errNoAssetSourceSet,
Expand Down Expand Up @@ -50,7 +49,8 @@ function generateAssetFileName(

function reserveFileNameInBundle(fileName: string, bundle: OutputBundleWithPlaceholders) {
if (fileName in bundle) {
return error(errFileNameConflict(fileName));
// FIXME this should return error(errFileNameConflict(fileName));
// but until #3174 is fixed, this raises spurious errors and is disabled
}
bundle[fileName] = FILE_PLACEHOLDER;
}
Expand Down
12 changes: 12 additions & 0 deletions test/chunking-form/samples/emit-same-file/_config.js
@@ -0,0 +1,12 @@
module.exports = {
options: {
input: 'main.js',
plugins: [
{
generateBundle() {
this.emitFile({ type: 'asset', fileName: 'myfile', source: 'abc' });
}
}
]
}
};
@@ -0,0 +1,9 @@
define(['exports'], function (exports) { 'use strict';

function hi() { return 2 }

exports.hi = hi;

Object.defineProperty(exports, '__esModule', { value: true });

});
@@ -0,0 +1 @@
abc
@@ -0,0 +1,7 @@
'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

function hi() { return 2 }

exports.hi = hi;
@@ -0,0 +1 @@
abc
@@ -0,0 +1,3 @@
function hi() { return 2 }

export { hi };
@@ -0,0 +1 @@
abc
12 changes: 12 additions & 0 deletions test/chunking-form/samples/emit-same-file/_expected/system/main.js
@@ -0,0 +1,12 @@
System.register([], function (exports) {
'use strict';
return {
execute: function () {

exports('hi', hi);

function hi() { return 2 }

}
};
});
@@ -0,0 +1 @@
abc
1 change: 1 addition & 0 deletions test/chunking-form/samples/emit-same-file/main.js
@@ -0,0 +1 @@
export function hi() { return 2 }

0 comments on commit 3100b4e

Please sign in to comment.