react-relay-network-modern icon indicating copy to clipboard operation
react-relay-network-modern copied to clipboard

Cannot find module 'core-js/modules/es6.object.define-property'

Open oreqizer opened this issue 5 years ago • 16 comments

Getting

Error: Cannot find module 'core-js/modules/es6.object.define-property'

when running my server.

Installed:

Installing [email protected] fixes the issue, but that's an obsolete dependency, would really like to avoid having to use it.

oreqizer avatar Jun 17 '19 14:06 oreqizer

Installing [email protected] fixes this!

Agree with the above that this should not be the case.

muntasirsyed avatar Jul 04 '19 14:07 muntasirsyed

Yes - currently Relay only supports core-js@2. This is not a problem with react-relay-network-modern, but with relay-runtime itself.

maraisr avatar Jul 31 '19 02:07 maraisr

@oreqizer If you want to use [email protected].

The better way is use the lib from es dir:

import { XXX } from 'react-relay-network-modern/es'

xyy94813 avatar Aug 15 '19 10:08 xyy94813

import { XXX } from 'react-relay-network-modern/es'

is not an option for me as I'm also using react-relay-network-modern-ssr, which imports from 'react-relay-network-modern/lib'

webican avatar Aug 25 '19 20:08 webican

This package needs to either specify an explicit dependency on core-js v2.x. Though in general, it's probably best not to use env with useBuiltIns for libraries regardless.

taion avatar Sep 17 '19 19:09 taion

I'm welcome to any performant solution.

core-js as explicit dependency adds 30kb of code for client bundles: https://bundlephobia.com/[email protected] And I don't feel that it's a good solution.

If you know how to fix this problem, please send a pull request. Tnx.

nodkz avatar Sep 23 '19 14:09 nodkz

It's a moot point. You're depending on core-js v2 anyway, so those files will get pulled in no matter what.

There's no way to avoid pulling in core-js v2; that code literally won't work without it. And in practice only the modules in use will get pulled in.

taion avatar Sep 23 '19 17:09 taion

Not including a required dependency doesn't help with bundle size. It's not possible to use this library without core-js, excluding it just means the library is broken by default

jquense avatar Sep 23 '19 17:09 jquense

For this repository, I don't think it needs to consider the runtime-env. Compatibility issues should be addressed in business project.

A and B project depend on RRNL, A project only need to consider newest browser, but B project user usually use old browser.

Be compatible for every user, it is too difficult.

So, we only need do it: flow => ES or mjs.


If babel-preset-env and useBuiltIns is necessary , we need to output a umd module by webpack.

xyy94813 avatar Sep 24 '19 08:09 xyy94813

I am facing this error: Cannot find module 'core-js/modules/es6.promise' But only when I try to build. On dev, it works perfectly.

jgcmarins avatar Dec 12 '19 21:12 jgcmarins

Hi guys, I have a similar problem. I have upgraded from version ^2.1.2 to ^4.3.0. Since then I get the following error messages:

ERROR in ./node_modules/react-relay-network-modern/lib/[filename]
Module not found: Error: Can't resolve 'core-js/modules/es7.symbol.async-iterator' in '/opt/sg/frontend/node_modules/react-relay-network-modern/lib'
...

LaurentHellebrandt avatar Jan 02 '20 10:01 LaurentHellebrandt

@jgcmarins did you solve this? I'm facing the same issue where I only get errors in my builds but when I run locally I get no errors. It's very confusing.

simkessy avatar Mar 03 '20 04:03 simkessy

If folks are running into this and don't necessarily need all the nice features in RRNM, we've written and switched to: https://github.com/4Catalyzer/relay-network-layer which is a good bit smaller (at the expense of other features) but still includes, batching and auth

jquense avatar Mar 03 '20 13:03 jquense

Solved my own problem. I do need core-js:2.6.9 but the issue I was seeing is that webpack would build locally but not in my docker. So I was really confused about that. It turns out locally i'm in a monorepo and the node_modules higher up the chain had the correct dependency. However in docker I only pushed my project so it couldn't a core-js version it needed. This explains why it was working locally but not in docker.

simkessy avatar Mar 03 '20 20:03 simkessy

@simkessy, I am using "core-js": "^3.6.3" and importing stuff from react-relay-network-modern/node8. check here: https://github.com/FotonTech/golden-stack/blob/74e31d98aa9f6c32cce5acec5664696754cbd6ec/packages/relay-ssr/src/RelayEnvironmentSSR.tsx#L17

jgcmarins avatar Mar 04 '20 03:03 jgcmarins

Stupid question, but does relay itself use core-js@2.* still? I was able to use relay without a problem, and when I tried importing from default RRNM package folder project wouldn't compile.

Looks like importing from react-relay-network-modern/es fixes it for me.

I think there should definitely be something in the readme explaining this.

michal-ciechan avatar Jun 22 '20 13:06 michal-ciechan