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