react-relay-network-modern
react-relay-network-modern copied to clipboard
Cannot find module 'core-js/modules/es6.object.define-property'
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.
Yes - currently Relay only supports core-js@2. This is not a problem with react-relay-network-modern, but with relay-runtime itself.
@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'
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'
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.
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.
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.
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
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
.
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.
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'
...
@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.
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
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, 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
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.