Skip to content

Commit

Permalink
✅(frontend) adapt babel to interpret declare keyword in typescript
Browse files Browse the repository at this point in the history
When we adapted the class in the plugin video.js, we use the keyword
"declare", which is not interpreted by babel. We need to add a plugin
to babel to interpret this keyword correctly.
  • Loading branch information
AntoLC authored and lunika committed Feb 21, 2024
1 parent cee17f3 commit 0ac7324
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/frontend/apps/lti_site/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module.exports = {
plugins: [
[
'@babel/plugin-transform-typescript',
{
allowDeclareFields: true,
},
],
[
'react-intl',
{
Expand Down
1 change: 1 addition & 0 deletions src/frontend/apps/lti_site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@babel/core": "7.23.9",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-transform-typescript": "*",
"@babel/polyfill": "7.12.1",
"@babel/preset-env": "7.23.9",
"@babel/preset-react": "7.23.3",
Expand Down
6 changes: 6 additions & 0 deletions src/frontend/apps/standalone_site/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ module.exports = babelJest.createTransformer({
ast: true,
},
],
[
'@babel/plugin-transform-typescript',
{
allowDeclareFields: true,
},
],
'babel-plugin-import-remove-resource-query',
'@babel/plugin-syntax-dynamic-import',
'babel-plugin-transform-vite-meta-env',
Expand Down
1 change: 1 addition & 0 deletions src/frontend/apps/standalone_site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"devDependencies": {
"@babel/core": "7.23.9",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-transform-typescript": "*",
"@babel/preset-env": "7.23.9",
"@babel/preset-typescript": "7.23.3",
"@testing-library/jest-dom": "*",
Expand Down
1 change: 1 addition & 0 deletions src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
},
"resolutions": {
"@babel/plugin-proposal-private-property-in-object": "7.21.11",
"@babel/plugin-transform-typescript": "7.23.6",
"@codemirror/lang-markdown": "6.2.4",
"@codemirror/language": "6.10.1",
"@codemirror/language-data": "6.4.1",
Expand Down
6 changes: 6 additions & 0 deletions src/frontend/packages/lib_video/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ module.exports = {
ast: true,
},
],
[
'@babel/plugin-transform-typescript',
{
allowDeclareFields: true,
},
],
'@babel/proposal-class-properties',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-runtime',
Expand Down
1 change: 1 addition & 0 deletions src/frontend/packages/lib_video/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-transform-runtime": "7.23.9",
"@babel/plugin-transform-typescript": "*",
"@babel/polyfill": "7.12.1",
"@babel/preset-env": "7.23.9",
"@babel/preset-typescript": "7.23.3",
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@
dependencies:
"@babel/helper-plugin-utils" "^7.22.5"

"@babel/plugin-transform-typescript@^7.23.3":
"@babel/plugin-transform-typescript@*", "@babel/plugin-transform-typescript@7.23.6", "@babel/plugin-transform-typescript@^7.23.3":
version "7.23.6"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.23.6.tgz#aa36a94e5da8d94339ae3a4e22d40ed287feb34c"
integrity sha512-6cBG5mBvUu4VUD04OHKnYzbuHNP8huDsD3EDqqpIpsswTDoqHCjLoHb6+QgsV1WsT2nipRqCPgxD3LXnEO7XfA==
Expand Down

0 comments on commit 0ac7324

Please sign in to comment.