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
Update babel dependencies #10810
Update babel dependencies #10810
Conversation
This is an automated check which relies on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build failed locally. Needs to investigate it further.
Message:
Module build failed: Error: Cannot find module '@babel/core'
babel-loader@8 requires Babel 7.x (the package '@babel/core'). If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'.
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Users/brbrr/Developer/a8c/jetpack/node_modules/babel-loader/lib/index.js:10:11)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/brbrr/Developer/a8c/jetpack/node_modules/babel-register/lib/node.js:152:7)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
Details:
module: Module[1000]
error: Error: Cannot find module '@babel/core'
babel-loader@8 requires Babel 7.x (the package '@babel/core'). If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'.
origin: null
dependencies: null
PR has been edited👷 This PR has received other commits, so Renovate will stop updating it to avoid conflicts or other problems. If you wish to abandon your changes and have Renovate start over you may click the "rebase" checkbox in the PR body/description. |
This is related to some conversations I had recently while working with @Automattic/team-calypso. One area of current work is publishing the parts of Calypso that are useful cross-organization or to a wider audience. One idea that came up was to export a core, opinionated, generic, build/babel/jsx/transpilation package. That wouldn't solve the issues present in this PR, but it could help alleviate some overhead maintaining separate build systems for Calypso and Jetpack's dashboard that have pretty much the same requirements. |
@sirreal I see that the Jetpack Babel config includes Stage 1 proposals. Is it some legacy from Babel 6, or are any of the non-standard JS features used in Jetpack code? First step to unify the Babel configs is to agree on one version of the language 🙂 Calypso uses standard ES2018 + JSX + class properties. Gutenberg is even more conservative, avoiding class properties syntax and having JSX as the only language extension. |
It is legacy that I moved from "old" config. Actually, I haven't checked that we still need these non-standard features. that's a good point - will be good to review usage. |
It aligns with the linter config/plugin moving into Calypso. We can make sure Jetpack code is compatible with whatever config Calypso provides. |
I like that. We already copied some of the practices from Calypso into Jetpack (and other projects), which makes total sense for me to have some centralized extendable configuration. One thing that I not sure about - it who should take it home. I am more than happy to work on this, but I will need to learn a lot :) |
I like the idea to publish a standard Babel config out of the Calypso repo and import it in other projects like Jetpack. These projects won't need to build the config from scratch, but will just override the defaults where needed (and if needed). The first step now should be to clean up the Jetpack Babel config. Upgrade to Babel 7. Remove the transforms that we don't need, especially the Stage 1 ones. Don't duplicate the config in Only as a step two, we'll be able to see the differences between Calypso and Jetpack clearly (maybe there won't be any?) and create a common package. Team Calypso can help here a lot. We've been through a Babel upgrade in Calypso already and cooperated with Gutenberg folks a lot. We know the details and gotchas of many Babel packages and transforms and options -- there's quite a learning curve there 🙂 |
Thanks! I'll re-visit Babel config, and will try to update to v7 next week |
b3a71e2
to
3a20deb
Compare
@brbrr @oskosk I tried to finish the Babel 7 upgrade and to make the config as simple as possible. The Babel config now does just a few things:
Can you do some testing and let me know if you find anything suspicious? I tested I had to patch several module reexports in the // module.js
export default { foo };
// user.js
import { foo } from 'module'; is not correct ES modules code. Another opportunity for simplification: rename Looking forward to upgrade webpack to v4 as a next step 🙂 |
There are ESLint and test failures on this branch. I'm working on them -- trying to fix everything without upgrading ESLint and the whole universe in one PR. |
Hi @brbrr and @jeherve 👋 While trying to resolve the remaining problems, I stumbled into a rabbit hole 😄 Jetpack repo uses a very old ESLint that's not compatible with Babel 7 (whose parser it uses via the To get out of this rabbit hole and finish the upgrades, it would help me if the codebase got reformatted with Prettier. That solves a lot of the formatting bugs. And then we can add the Doing these changes makes a clean and error-free ESLint upgrade possible. What do you think? |
That would be nice indeed, I am all for prettier things :) (related: #10784), but I have no experience with running Prettier on a whole codebase and how that would look like. How did it work for Calypso? Should we go at it in multiple PRs, one per file, one per section? |
Calypso was the first Automattic project to use Prettier, so we went mostly per section and debugged our fork (that adds WordPress-style paren spacing) on the way. For Jetpack repo, I think it's best to do it in one PR. I experimented a bit in my working copy and ended up with two questions:
|
Yes, I would agree about limiting things to
How are things configured in Calypso, and if you enabled Prettier for SCSS there, did you do it at the same time as enabling it for JS, or later? |
We enabled it later, and still haven't reformatted everything. When trying to format SCSS files in #11007, I encountered some errors that made me decide to postpone SCSS for later. I filed #11007 to do the reformat. Some extra nontrivial steps needed to be taken before it worked 100%. |
3a20deb
to
7ef1002
Compare
PR: #11507 |
Exporting an object as default doesn't make the object properties into named exports. That's a CommonJS backward compatibility hack and is not valid ES module syntax. Converting lets us drop the `add-module-exports` Babel plugin.
- remove unneeded plugins from Babel config - add the ES3-compat transform (member properties, literals, reserved words) - remove the duplicate webpack config bits
This reverts commit 21c49c3.
551c3cd
to
6aaa2d9
Compare
Rebased now that #11677 has landed with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works in my testing 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, testing fine & code's looking great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Installed and built without error. I merged it with master with all of the gutenblock source and build work, built fine, admin dashboard works without issue in the console and blocks worked. Let's do it.
This PR contains the following updates:
7.1.5
->8.0.4
Release Notes
babel/babel-loader
v8.0.4
Compare Source
v8.0.3
Compare Source
Features
customize
optionBugs
Docs
Internal
Some dev dependency updates and CI tweaks.
v8.0.2
Compare Source
cacheCompression: false
to disable GZip compression of the disk cachesourceMaps: 'inline'
to work properly withbabel-loader
devtoolModuleFilenameTemplate
placeholdersv8.0.1
Compare Source
@babel/core
or installbabel-core
.v8.0.0
Compare Source
This is the first stable release of
babel-loader
for Babel 7.x.Renovate configuration
📅 Schedule: At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻️ Rebasing: Whenever PR becomes conflicted, or if you modify the PR title to begin with "
rebase!
".🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot. View repository job log here.