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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught TypeError: Object.defineProperty called on non-object #5525
Comments
Use this babel config:
because:
|
OMG yes that does work! I have to be honest, I don't understand why it didn't work and I don't understand why it works now. I'll have to spend the time digging into all this so I'm not just a user of it all and get some sense of understanding. Thanks so much for looking into and smashing that bug! |
The docs will soon have a section about this: parcel-bundler/website#784 |
As explained on https://v2.parceljs.org/languages/babel/, you should use |
I'm seeing this in Specifically, the debugger shows this as occuring at this line in the built JS resource: ...
}
// ASSET: js/ModulePane.js
var $7da7259b87a02879c5c7f1ef679fefc5$var$_interopRequireDefault = $84365f2fa51ab86fecf2004980c3e449$exports;
var $7da7259b87a02879c5c7f1ef679fefc5$var$_interopRequireWildcard = $61a762bf44d77268ef68463a5504d79b$exports;
Object.defineProperty($7da7259b87a02879c5c7f1ef679fefc5$exports, "__esModule", { // <--- ERROR HERE
value: true
});
... (Debugger show '$7da7259b87a02879c5c7f1ef679fefc5$exports' as being undefined) Error occurs both with and without the |
Have you tried this config as well?
That did the trick for me |
Hi @PiTiLeZarD, thanks for putting together the code sample. I'm running into the same issue as you were, seemingly at the same codepoint as @broofa posted. I've cloned your sample repo, run the following,
When I access the site served from
It turns out this occurs on the first ES module import. When I step into that import statement, I encounter an amusing error from
Just searching for that text brought me to a babel issue that was mentioned in a babel pull request. So, I thought... why not update babel? TLDRIn summary, I bumped
The "baseline" |
馃悰 bug report
Using Parcel 2.0.0-beta.1, react relay and yarn workspaces, produces a non-working build. Using the option no-scope-hoist fixes the build.
馃帥 Configuration (.babelrc, package.json, cli command)
All configs available there: https://github.com/PiTiLeZarD/testapp_bugreport
馃 Expected Behavior
It should work both with or without tree shaking. (I think?)
馃槸 Current Behavior
Will produce the error. You probably know about it already, but I need to edit the index.html to load the js from that folder... I mean... I know you know that but I feel like I have to say it anyway haha
馃拋 Possible Solution
Solves the issue, I didn't dig in parcel's entrails to suss out where is the root of the issue so I can't provide more here sorry.
馃敠 Context
I was refactoring all my code to a mono repo, got to the end of what would work with parcel 1, tried parcel 2, mostly everything worked up until I used the graphql keyword.
I ended up on this issue: #4559 and I've been asked to create a new bug report.
馃捇 Code Sample
I've committed the code here:
https://github.com/PiTiLeZarD/testapp_bugreport
Tested it on 2 machines with similar result
馃實 Your Environment
All environments are in both package.json (workspace and testapp)
Thanks for looking into this, and merry time to all of you ;)
The text was updated successfully, but these errors were encountered: