Skip to content

Commit

Permalink
Restore ability to use console.log in vite
Browse files Browse the repository at this point in the history
- Swap our swc plugin to remove-react-properties
- Configure remove-react-properties to preserve our testids
  • Loading branch information
twk3 committed Jan 15, 2024
1 parent a8b42bc commit e1897ab
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/desktop-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@svgr/cli": "^8.0.1",
"@swc/core": "^1.3.82",
"@swc/helpers": "^0.5.1",
"@swc/plugin-remove-console": "^1.5.105",
"@swc/plugin-react-remove-properties": "^1.5.108",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.4.3",
"@types/react": "^18.2.0",
Expand Down
7 changes: 6 additions & 1 deletion packages/desktop-client/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ export default defineConfig(async ({ mode }) => {
injectShims(),
addWatchers(),
react({
plugins: [['@swc/plugin-remove-console', {}]],
plugins: [
[
'@swc/plugin-react-remove-properties',
{ properties: ['^data-debug'] },
],
],
devTarget: 'es2022',
}),
viteTsconfigPaths({ root: '../..' }),
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ __metadata:
"@svgr/cli": "npm:^8.0.1"
"@swc/core": "npm:^1.3.82"
"@swc/helpers": "npm:^0.5.1"
"@swc/plugin-remove-console": "npm:^1.5.105"
"@swc/plugin-react-remove-properties": "npm:^1.5.108"
"@testing-library/react": "npm:14.0.0"
"@testing-library/user-event": "npm:14.4.3"
"@types/react": "npm:^18.2.0"
Expand Down Expand Up @@ -3752,10 +3752,10 @@ __metadata:
languageName: node
linkType: hard

"@swc/plugin-remove-console@npm:^1.5.105":
version: 1.5.105
resolution: "@swc/plugin-remove-console@npm:1.5.105"
checksum: b82710090c3202a473771a9c6a67da3fd5136e19d8214b967de8d3010139d95727f0834920cbb3a4fb284d68f363a4650d32f692c5293854e902b5fa33c3fbab
"@swc/plugin-react-remove-properties@npm:^1.5.108":
version: 1.5.108
resolution: "@swc/plugin-react-remove-properties@npm:1.5.108"
checksum: 7d849702d036353f2d58515aa20e4557379fccda3d48b2a38835415e3a37fe1ce1c560fbc64e164a8fc09b833c42ecc4a39775cc1d6da8ba83860a464ddcb24f
languageName: node
linkType: hard

Expand Down

0 comments on commit e1897ab

Please sign in to comment.