question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tvquizphdcommented, Apr 15, 2021

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,

yarn install
yarn relay
yarn build

When I access the site served from dist, I immediately see a familiar error:

index.js:2 Uncaught TypeError: Object.defineProperty called on non-object
    at Function.defineProperty (<anonymous>)

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-runtime v0.13.7 at the very end of that module with a comment that begins:

// This module should not be running in strict mode, so the above
// assignment should always work unless something is misconfigured....

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/core from ^7.12.10 to ^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_URL in my environment.

The ā€œbaselineā€ App.jsx without any functionality can import a relay environment and write some JSON strings to the DOM.

1reaction
mischniccommented, Dec 25, 2020

The docs will soon have a section about this: https://github.com/parcel-bundler/website/pull/784

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Object.defineProperty called on non-object JQUERY
I have this error in Jquery when I try to each an array of HTML elements and handle onclick of that element. Object.keys(collapsibles).forEach(Ā ......
Read more >
TypeError: Object.defineProperty called on non-object JQUERY
I have this error in Jquery when I try to each an array of HTML elements and handle onclick of that element.
Read more >
issue converting plugin to typescript with webpack
Uncaught TypeError : Object.defineProperty called on non-object at Function.defineProperty (<anonymous>) at Function.__webpack_require__.rĀ ...
Read more >
Object.defineProperty() - JavaScript - MDN Web Docs
A TypeError is thrown when attempts are made to change non-configurable property attributes (except value and writable , if permitted), exceptĀ ...
Read more >
jquery error - WordPress.org
i am getting this error after updating to WordPress 5.6 (latest version):. Uncaught TypeError: Object.defineProperty called on non-object in jquery.min.js:2.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found