storyblok / storyblok-js-client

Universal JavaScript client for Storyblok's API
MIT License
127 stars 87 forks source link

Upgrade to core-js 3 #20

Closed andreiho closed 5 years ago

andreiho commented 5 years ago

After upgrading core-js to version 3, I get this error:

Error: Cannot find module 'core-js/modules/es6.function.name'

Upgrading the babel plugin to v3 should do the trick. See here.

onefriendaday commented 5 years ago

Thanks for the report

We created a feature branch vor v3. npm install --save storyblok/storyblok-js-client#feature/corejs-3

LukasMachetanz commented 5 years ago

I have the same problem when using the storyblok-js-client in an Angular (version 8) project.

The error looks like this:

ERROR in ./node_modules/storyblok-js-client/dist/throttlePromise.js Module not found: Error: Can't resolve 'core-js/modules/es6.function.name' in '/Users/machetanz/DEV/design-system/node_modules/storyblok-js-client/dist'

Currently I installed the version 2.5.4 of core-js to fix this error. Is there a better approach than installing an older/deprecated version of core-js to fix this error?

Thanks in advance. :)

andreiho commented 5 years ago

@LukasMachetanz Update storyblok-js-client to 1.0.28, this version depends on core-js@3.

LukasMachetanz commented 5 years ago

@andreiho The error occurred with this version. I assume that should not be the case if you are suggesting this as a solution?

andreiho commented 5 years ago

@LukasMachetanz If you depend on storyblok-js-client@1.0.28 and core-js@3 you shouldn't have any problems. At least I don't anymore.

See throttlePromise.js. The correct path is required, so if you're still getting Error: Can't resolve 'core-js/modules/es6.function.name' you have an older version installed.

LukasMachetanz commented 5 years ago

I tried it in a new project; it is working now. Thank you for your help and the quick answer. Sorry that I had to bother you again.

SOLVED & CLOSED ;)

samhiddenhand commented 5 years ago

On brand new create-react-app installs, the latest version of storyblok-js-client still gives this error, and the error found at https://github.com/storyblok/storyblok-js-client/issues/23

I'm able to resolve it by using the storyblok/storyblok-js-client#feature/corejs-3 feature branch, but that doesn't seem to have Storyblok.richTextResolver in it...

Is there any way to update the main current version so that it installs correctly with create-react-app on a fresh install?

samhiddenhand commented 5 years ago

To follow up on my comment, I just noticed that when I run an npm install of storyblok-js-client without specifying which version, it installs an older version. I manually specified the latest version, and things seem to work.

andreiho commented 5 years ago

It looks like the latest tag is wrong in npm: https://www.npmjs.com/package/storyblok-js-client

jajouka79 commented 5 years ago

in my project deps i have :

"core-js": "^3.3.2", "storyblok-js-client": "storyblok/storyblok-js-client#feature/corejs-3", and in dev-deps :

"storyblok-migrate": "^0.3.3",

when i run

npx storyblok-backup --components --stories

i get the same error: ` Cannot find module 'core-js/modules/es6.function.name' Require stack:

is this a related issue?

I have removed node_modules and rebuilt the project several times but im still getting this error.

jajouka79 commented 5 years ago

in the node_modules/storyblok-js-client/package.json the version is :

"name": "storyblok-js-client", "version": "1.0.28",

andreiho commented 5 years ago

@jajouka79 Try using storyblok-js-client 2.

jajouka79 commented 5 years ago

thanks andre, i have tried with this as well :

"storyblok-js-client": "2.0.10",

but i am getting the same error