Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default reexports of a CommonJS asset on namespace object are undefined #6909

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as x from './b.js';
output = sideEffectNoop(x).foo;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default as foo} from './c.js'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'foo';
12 changes: 12 additions & 0 deletions packages/core/integration-tests/test/scope-hoisting.js
Original file line number Diff line number Diff line change
Expand Up @@ -1775,6 +1775,18 @@ describe('scope hoisting', function() {
assert.deepEqual(output, 'foo');
});

it('support accessing default reexports of a CommonJS asset on namespace object', async function() {
let b = await bundle(
path.join(
__dirname,
'/integration/scope-hoisting/es6/re-export-commonjs-namespace/a.js',
),
);

let output = await run(b);
assert.deepEqual(output, 'foo');
});

it('concatenates in the correct order when re-exporting assets were excluded', async function() {
let b = await bundle(
path.join(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test-utils/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export async function runBundles(

// A utility to prevent optimizers from removing side-effect-free code needed for testing
// $FlowFixMe[prop-missing]
ctx.sideEffectNoop = () => {};
ctx.sideEffectNoop = v => v;

vm.createContext(ctx);
let esmOutput;
Expand Down