Skip to content

Commit

Permalink
Add "type": "module" to package.json (#309)
Browse files Browse the repository at this point in the history
It ensures that the ESM build of Vite is used instead of the CJS build
(deprecated). See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated

This is also consistent with the Vite React templates:
https://github.com/vitejs/vite/blob/cdc664d4ea98d5373c3ceb2213771f1dfa4bb457/packages/create-vite/template-react-ts/package.json#L5

Because we were using TypeScript to begin with (and therefore the ESM
syntax for import/export), no change is required in source files.

Note that because ESM ("es") was already the default output format for
rollupjs, I don't think there is any difference in the final app
(index.html was already using `<script type="module">`). So in essence,
this change is really about avoiding the deprecation warning from Vite.

.eslintrc.js had to be renamed to .eslintrc.cjs. ESLint currently does
not support ESM configuration.

Signed-off-by: Antonin Bas <[email protected]>
  • Loading branch information
antoninbas authored Mar 25, 2024
1 parent 40d3393 commit 631093e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 0 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions client/web/antrea-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "antrea-ui",
"version": "0.1.0",
"private": true,
"type": "module",
"dependencies": {
"@cds/city": "^1.1.0",
"@cds/core": "^6.5.0",
Expand Down

0 comments on commit 631093e

Please sign in to comment.