Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Playground build; Remove @babel/polyfill import from the playground #15947

Merged
merged 1 commit into from
Jun 11, 2019

Conversation

jorgefilipecosta
Copy link
Member

@jorgefilipecosta jorgefilipecosta commented May 31, 2019

Description

Removes the @babel/polyfill import from the playground. The screen seems to work as expected without it, and with it, the build fails.

How has this been tested?

I executed npm run playground:start
I verified the build was successful without errors, on master it failed.

Fixes #16082.

@jorgefilipecosta jorgefilipecosta added [Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling labels May 31, 2019
@aduth
Copy link
Member

aduth commented Jun 7, 2019

The screen seems to work as expected without it, and with it, the build fails.

Do we know any more about what caused this?

@aduth
Copy link
Member

aduth commented Jun 7, 2019

The screen seems to work as expected without it, and with it, the build fails.

Do we know any more about what caused this?

My guess: The introduction of the playground in #14497 did not define an explicit dependency on @babel/polyfill despite importing it directly. It should have. It probably worked by virtue of some transitive dependency, which since was lost (possibly a result of recent Babel upgrade in #15139.

The polyfill would be important if we wanted to support older browsers. If we want to, we could just as easily install the @babel/polyfill package as an explicit dependency, which I expect would also fix the issue.

@aduth
Copy link
Member

aduth commented Jun 7, 2019

If we want to, we could just as easily install the @babel/polyfill package as an explicit dependency, which I expect would also fix the issue.

Hmm, I tried this in my local copy of the branch and I'm still seeing the error.

🚨  /Users/andrew/Documents/Code/vvv/www/editor/htdocs/wp-content/plugins/gutenberg/playground/src/index.js: Cannot resolve dependency 'core-js/modules/es6.array.fill'
    at Resolver.resolve (/Users/andrew/Documents/Code/vvv/www/editor/htdocs/wp-content/plugins/gutenberg/node_modules/parcel-bundler/src/Resolver.js:71:17)

This despite clearly having installed core-js immediately prior in npm install

> [email protected] postinstall /Users/andrew/Documents/Code/vvv/www/editor/htdocs/wp-content/plugins/gutenberg/node_modules/@babel/polyfill/node_modules/core-js
> node scripts/postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
...

@gziolo
Copy link
Member

gziolo commented Jun 7, 2019

I think I know what the issue is. See in https://unpkg.com/[email protected]/package.json:

"@babel/core": "^7.0.0 <7.4.0",

We use Babel 7.4.x but Parcel is still on lower version …

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm fine with this fix until parcel updates to the latest babel version or we move away from parcel.

@jorgefilipecosta jorgefilipecosta changed the title Fix: Playground build Fix: Playground build; Remove @babel/polyfill import from the playground Jun 11, 2019
@jorgefilipecosta jorgefilipecosta merged commit 0563331 into master Jun 11, 2019
@jorgefilipecosta jorgefilipecosta deleted the fix/playground-build branch June 11, 2019 13:42
@jorgefilipecosta
Copy link
Member Author

Thank you for the explorations around this problem, I did not had much information about this problem, but I used this "fix" locally to be able to run the playground. I merged the "fix" for now if someone has a better alternative I think we can discuss it in a follow-up PR.

@gziolo gziolo added this to the Gutenberg 6.0 milestone Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playground won't run - cannot resolve dependency core-js/modules/es6.array...
4 participants