Skip to content

Commit 215140a

Browse files
committed
Migrate from Babel to SWC transpiler
1 parent 104f07a commit 215140a

File tree

6 files changed

+199
-1021
lines changed

6 files changed

+199
-1021
lines changed

.eslintrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ extends:
55
- plugin:jsx-a11y/recommended
66
- prettier
77

8+
parser: espree
9+
10+
parserOptions:
11+
ecmaVersion: 2022
12+
sourceType: module
13+
ecmaFeatures:
14+
jsx: true
15+
816
plugins:
917
- react
1018
- jsx-a11y

.swcrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"jsc": {
3+
"parser": {
4+
"syntax": "ecmascript",
5+
"jsx": true,
6+
"dynamicImport": true
7+
},
8+
"transform": {
9+
"react": {
10+
"runtime": "automatic"
11+
}
12+
}
13+
},
14+
"module": {
15+
"type": "es6"
16+
}
17+
}

babel.config.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

config/shakapacker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ default: &default
88
cache_path: tmp/shakapacker
99
webpack_compile_output: true
1010
nested_entries: true
11-
javascript_transpiler: babel
11+
javascript_transpiler: swc
1212

1313
# Additional paths webpack should lookup modules
1414
# ['app/assets', 'engine/foo/app/assets']

package.json

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@
3131
"build:clean": "rm -rf public/packs || true"
3232
},
3333
"dependencies": {
34-
"@babel/cli": "^7.21.0",
35-
"@babel/core": "^7.21.0",
36-
"@babel/plugin-transform-runtime": "^7.21.0",
37-
"@babel/preset-env": "^7.20.2",
38-
"@babel/preset-react": "^7.18.6",
3934
"@babel/runtime": "^7.17.9",
4035
"@glennsl/rescript-fetch": "^0.2.0",
4136
"@glennsl/rescript-json-combinators": "^1.2.1",
@@ -47,9 +42,6 @@
4742
"@rescript/react": "^0.11.0",
4843
"autoprefixer": "^10.4.14",
4944
"axios": "^0.21.1",
50-
"babel-loader": "^9.1.2",
51-
"babel-plugin-macros": "^3.1.0",
52-
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
5345
"classnames": "^2.3.2",
5446
"compression-webpack-plugin": "10.0.0",
5547
"css-loader": "^6.7.3",
@@ -106,11 +98,12 @@
10698
"webpack-merge": "5"
10799
},
108100
"devDependencies": {
109-
"@babel/eslint-parser": "^7.16.5",
110101
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
102+
"@swc/core": "^1.3.100",
103+
"@swc/jest": "^0.2.29",
111104
"@tailwindcss/typography": "^0.5.10",
105+
"swc-loader": "^0.2.3",
112106
"@webpack-cli/serve": "^2.0.5",
113-
"babel-jest": "^29.5.0",
114107
"body-parser": "^1.20.2",
115108
"eslint": "^8.35.0",
116109
"eslint-config-prettier": "^8.6.0",
@@ -155,7 +148,7 @@
155148
],
156149
"testRegex": "./app/.*.spec\\.jsx?$",
157150
"transform": {
158-
"^.+\\.jsx?$": "babel-jest"
151+
"^.+\\.jsx?$": "@swc/jest"
159152
}
160153
},
161154
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"

0 commit comments

Comments
 (0)