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

Transpilation differences between parcel .. and parcel build #6056

Closed
achingbrain opened this issue Mar 25, 2021 · 2 comments · Fixed by #6230
Closed

Transpilation differences between parcel .. and parcel build #6056

achingbrain opened this issue Mar 25, 2021 · 2 comments · Fixed by #6230

Comments

@achingbrain
Copy link

🐛 bug report

I have CJS dependencies that destructure required modules:

const { foo: bar } = require('some-dep')

// use `bar`

These work as expected when using the dev server started by parcel ./path/to/index.html but if I run the js created by parcel build ./path/to/index.html it fails in the browser with errors similar to bar is not defined.

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

No config, only the defaults.

🤔 Expected Behavior

The code should be the same when created by the dev server or the bundle command.

😯 Current Behavior

See above.

💁 Possible Solution

🤷‍♂️

🔦 Context

Trying to build an app

💻 Code Sample

See above.

🌍 Your Environment

Software Version(s)
Parcel 2.0.0-beta.2
Node 15.11.0
npm/Yarn npm 7.6.0
Operating System Mac OS X
@achingbrain
Copy link
Author

This seems to be related to scope hoisting - if I pass the --no-scope-hoist flag it works as expected.

@ghost
Copy link

ghost commented Mar 31, 2021

--no-scope-hoist

I was getting the error TypeError: Object.defineProperty called on non-object. Adding --no-scope-hoist fixed that for me also.

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.

2 participants