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

perf: transpile js to es6 #3699

Merged
merged 4 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
768 changes: 0 additions & 768 deletions js-packages/webpack-config/.yarn/releases/yarn-3.1.0.cjs

This file was deleted.

1 change: 0 additions & 1 deletion js-packages/webpack-config/.yarnrc.yml

This file was deleted.

25 changes: 21 additions & 4 deletions js-packages/webpack-config/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
module.exports = {
assumptions: {
// Defines assumptions Babel can make about our
// code to better optimise it.
//
// These are rarely used features that are generally
// considered very bad practice anyway.
//
// See: https://babeljs.io/docs/en/assumptions
constantSuper: true,
ignoreFunctionLength: true,
noDocumentAll: true,
noNewArrows: true,
privateFieldsAsProperties: true,
},
targets: {
// `not android > 0` means the build-in Android browser used up to Android 4.4 KitKat.
browsers: '>0.2%, not dead, not android > 0, not operamini all',
},
presets: [
require.resolve('@babel/preset-react'),
require.resolve('@babel/preset-typescript'),
[
require.resolve('@babel/preset-env'),
{
modules: false,
loose: true,
modules: 'auto',
},
],
],
plugins: [
[require.resolve('@babel/plugin-transform-runtime'), { useESModules: true }],
[require.resolve('@babel/plugin-proposal-class-properties'), { loose: true }],
[require.resolve('@babel/plugin-proposal-private-methods'), { loose: true }],
[require.resolve('@babel/plugin-proposal-class-properties')],
[require.resolve('@babel/plugin-proposal-private-methods')],
[
require.resolve('@babel/plugin-transform-react-jsx'),
{
Expand Down
2 changes: 1 addition & 1 deletion js-packages/webpack-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const plugins = [];
* is required at build-time from an extension/core's scope) are redirected to the
* copy of `@babel/runtime` which is a dependency of this package.
*
* This removes the need for hoisting, and allows for Plyug'n'Play compatibility.
* This removes the need for hoisting, and allows for Plug'n'Play compatibility.
*
* Thanks goes to Yarn's lead maintainer @arcanis for helping me get to this
* solution.
Expand Down
34 changes: 19 additions & 15 deletions js-packages/webpack-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,31 @@
"main": "index.js",
"author": "Flarum Team",
"license": "MIT",
"prettier": "@flarum/prettier-config",
"peerDependencies": {
"webpack": "^5.76.0"
},
"dependencies": {
"@babel/core": "^7.16.0",
"@babel/plugin-proposal-class-properties": "^7.16.0",
"@babel/plugin-proposal-private-methods": "^7.16.0",
"@babel/plugin-transform-object-assign": "^7.16.0",
"@babel/plugin-transform-react-jsx": "^7.16.0",
"@babel/plugin-transform-runtime": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"@babel/preset-react": "^7.16.0",
"@babel/preset-typescript": "^7.16.0",
"@babel/runtime": "^7.16.0",
"babel-loader": "^8.2.3",
"typescript": "^4.4.4",
"@babel/core": "^7.20.2",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@babel/plugin-transform-object-assign": "^7.18.6",
"@babel/plugin-transform-react-jsx": "^7.19.0",
"@babel/plugin-transform-runtime": "^7.19.6",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@babel/runtime": "^7.20.1",
"babel-loader": "^9.1.0",
"typescript": "^4.9.3",
"webpack": "^5.76.0",
"webpack-bundle-analyzer": "^4.5.0"
"webpack-bundle-analyzer": "^4.7.0"
},
"devDependencies": {
"prettier": "^2.4.1"
"prettier": "^2.8.0",
"@flarum/prettier-config": "^1.0.0"
},
"packageManager": "yarn@3.1.0"
"scripts": {
"format": "prettier --write ."
}
}