Uncaught TypeError: Object.defineProperty called on non-object
See original GitHub issue🐛 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
yarn install
yarn relay
yarn build
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
yarn build:nohoist
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: https://github.com/parcel-bundler/parcel/issues/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 😉
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Related StackOverflow Question
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
dist, I immediately see a familiar error:It turns out this occurs on the first ES module import. When I step into that import statement, I encounter an amusing error from
regenerator-runtimev0.13.7 at the very end of that module with a comment that begins: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?
TLDR
In summary, I bumped
@babel/corefrom^7.12.10to^7.13.15, and ran the three-step build process again. Now it seems I’m making progress. Your test app still fails to render, but only because I don’t haveGRAPHQL_API_URLin my environment.You can see I’ve updated babel here: tvquizphd/testapp_bugreport/update-babel.
And, as a “baseline”, I’ve removed the GraphQL requests here: tvquizphd/testapp_bugreport/update-babel-no-graphql.
The “baseline”
App.jsxwithout any functionality can import a relay environment and write some JSON strings to the DOM.The docs will soon have a section about this: https://github.com/parcel-bundler/website/pull/784