parcel icon indicating copy to clipboard operation
parcel copied to clipboard

esmodule output format: reexports from a different bundle are missing

Open mischnic opened this issue 5 years ago • 1 comments

🐛 bug report

Reexporting something from a file that is also used in a parent bundle doesn't work.

🎛 Configuration (.babelrc, package.json, cli command)

{
	"module": "dist/a.js",
	"dependencies": {
		"@babel/core": "^7.12.10"
	},
	"browserslist": "Chrome 80"
}

🤔 Expected Behavior

console:

index 1
b 1
async import 1

😯 Current Behavior

console:

index 1
b 1
async import undefined

async bundle output:

import {$c650aa1277a163642fe468b4d4961070$init} from "./a.js";
console.log("b", $c650aa1277a163642fe468b4d4961070$init().shared);

💻 Code Sample

// a.js
import { shared } from "./c.js";
console.log("index", shared);
import("./b.js").then((ns) => console.log("async import", ns.shared));

// b.js
import { shared } from "./c.js";
console.log("b", shared);
export { shared } from "./c.js";

// c.js
export const shared = 1;

🌍 Your Environment

Software Version(s)
Parcel 913c69b75abfb9f601ff788d7058b2969a7d88a5

mischnic avatar Jan 14 '21 20:01 mischnic

I am facing a similar error. It seems re-exporting Node's built-in modules fails silently.

Here is the reproduction:

 ReferenceError: $3b34b48be461ec36$re_export$delimiter is not defined

https://github.com/aminya/setup-cpp/runs/7944460774?check_suite_focus=true#step:7:1496

I tried to reproduce it in the package itself, but it works there. The issue seems to be when using a reexported symbol again in a new package

https://github.com/aminya/patha/blob/master/test/node-integration.mjs

The re-exporting happens here. https://github.com/aminya/patha/blob/master/src/index.ts

Like so:

export {delimiter} from "path"

aminya avatar Aug 22 '22 07:08 aminya

I'm facing the same problem, the workaround was:

import * as some from 'something';

const func = some.func;

export { func };

Do they working on some fix for this??

mverissimo avatar Nov 29 '22 01:11 mverissimo