storyblok / gatsby-source-storyblok

Gatsby source plugin for building websites using the Storyblok headless CMS as a data source.
MIT License
43 stars 35 forks source link

Error after adding library to repo and running gatsby develop #27

Closed IgorPodlawski closed 4 years ago

IgorPodlawski commented 4 years ago

Hi!

I'm getting error after adding gatsby-source-storyblok to my repo and running gatsby develop.

Error message:

Error: Cannot find module 'core-js/modules/es6.regexp.split'

This is probably related to Babel changes: https://github.com/facebook/jest/issues/8476#issuecomment-494124876

After downgrading core-js dependency from 3.6.5 to 2.6.5 everything works fine in my website repo.

BrieucCaillot commented 4 years ago

Same error message here! Downgrading core-js to 2.6.5 will fix this error but creates unrelated errors on others gatsby plugins.

heresandyboy commented 4 years ago

Hi, this issue is also directly affecting the gatsby-storyblok-boilerplate and an issue has been raised here #12

I've added some comments there. quoted here for reference

Hi, I can confirm this issue. Temporary workaround is to directly install dependency core-js and pin to the older version 2.6.5

yarn install core-js@2.6.5

However this is likely to cause issues with some other Gatsby plugins.

I have yet to take the time to dig any deeper, however it's clear the issue comes from breaking changes in core-js v3.x.x.

CHANGELOG.md#300---20190319

Move all features from ES5, ES2015, ES2016, ES2017, ES2018 and ES2019 to one namespace for stable ES 
- it's available as core-js/es, all those features in modules folder has es. prefix.
Change prefix for ES proposals from es7. to esnext., they no longer available in core-js/es7, use core-js/stage/* instead of that.

Meaning any references to core-js modules that use the es number, like core-js/modules/es6.regexp.split actually need to be refactored to something like 'core-js/modules/es.regexp.split

core-js@3.6.5 is coming in as a dependency for all the gatsby plugins, however the following dependencies pull in core-js@2.6.11

  • gatsby#core-js@2.6.11
  • @babel/polyfill#core-js@2.6.11
  • @babel/runtime-corejs2#core-js@2.6.11
  • babel-runtime#core-js@2.6.11
  • gatsby-source-storyblok#storyblok-js-client#@babel#runtime-core

There is also an issue regarding the same issue on the gatsby-source-storyblok git repo: #27

Hopefully a fix would be to update all dependencies to latest but I have not tried this, it depends if those have updated to core-js 3.x.x also.

Update: It looks like storyblok-js-client is now using @babel/runtime-corejs3, couldn't see when it was updated, but current version is storyblok-js-client@2.5.1, however gatsby-source-storyblok is still using storyblok-js-client@1.0.22

Looks like we need a fair bit of upstream maintenance to get this sorted. I'll see if I can commit any time but help would be awesome.

heresandyboy commented 4 years ago

This issue is now fixed and released in gatsby-source-storyblok v1.0.0 😁

@emanuelgsouza we can close this issue now thanks for merging my changes! 👌

emanuelgsouza commented 4 years ago

Great! Thanks for your PR!