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

Regression: parcel@2.8.0 build keeps undefined $08c370c820b39c31$exports for ESM #8624

Closed
arty-name opened this issue Nov 11, 2022 · 6 comments · Fixed by #8645
Closed

Regression: parcel@2.8.0 build keeps undefined $08c370c820b39c31$exports for ESM #8624

arty-name opened this issue Nov 11, 2022 · 6 comments · Fixed by #8645

Comments

@arty-name
Copy link
Contributor

🐛 bug report

When I import two particular packages (one depends on another) the and run parcel build, the output file code uses an undefined identifier $08c370c820b39c31$exports. Trying to actually use the code from the file results in error then.

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

There’s no configuration beyond "type": "module" in package.json. I just run parcel build index.js.

import { TypeRegistry } from '@polkadot/types'
import { ApiPromise } from '@polkadot/api'

console.log(TypeRegistry, ApiPromise)

🤔 Expected Behavior

When optimizing the code parcel should not remove declarations of constants that are used in the code.

😯 Current Behavior

The code includes the line var gs={};r(gs,"*",(()=>$08c370c820b39c31$exports)),... and $08c370c820b39c31$exports is not defined anywhere, resulting in runtime errors during more complex usage.

💁 Possible Solution

Stay on parcel@2.7.0 for now?

🔦 Context

I was trying to upgrade a project to use the latest parcel@2.8.0 and will not do this now.

💻 Code Sample

To reproduce:

git clone https://github.com/arty-name/parcel-build-fail
cd parcel-build-fail
yarn install
yarn run build

🌍 Your Environment

Software Version(s)
Parcel 2.8.0
Node v18.12.1
Yarn 1.22.19
Operating System Ubuntu 22.10
@niicojs
Copy link
Contributor

niicojs commented Nov 14, 2022

I have the same issue. In my case it seems that it's D3 that is not included in the bundle.
By the way, in my case reverting to 2.7.0 does not solve it. Does it come from a dependency?

@mischnic
Copy link
Member

mischnic commented Nov 17, 2022

@arty-name I cloned your repo and then running the result with node dist/index.js worked fine for me. Even when adding "use strict"; at the top.

I have the same issue. In my case it seems that it's D3 that is not included in the bundle.
By the way, in my case reverting to 2.7.0 does not solve it. Does it come from a dependency?

@niicojs Please open a new issue with a reproduction

@arty-name
Copy link
Contributor Author

@mischnic yes, running the code as is does not throw. I did not include a more complex example that throws because even with the basic example, the output file contains the undefined variable. Should I also provide an example that throws an error?

@mischnic
Copy link
Member

No, I did find the undefined variable in the meantime:

var $641923ca85682c73$exports = {};
$parcel$export($641923ca85682c73$exports, "*", () => $cdef374e0b4cc0a5$exports); // <-----
$parcel$export($641923ca85682c73$exports, "GenericExtrinsic", () => $cdef374e0b4cc0a5$export$84cf34f56e9b2fd5);
// Copyright 2017-2022 @polkadot/types authors & contributors

@arty-name
Copy link
Contributor Author

arty-name commented Dec 15, 2022

Hi @mischnic, I have a similar bug with the brand new 2.8.2 (and 2.8.1 as well): now the name of the undefined variable is $7f9d4f94f3d938e3$re_export$bool. Should I reopen this issue or create a new one? I don’t yet have a minimal code example, but here’s the parcel update PR in my project and it’s deployed version.

@mischnic
Copy link
Member

@arty-name Please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants