I was created the vite2 project from create-react-app project,
the code is working on the CRA project,
but I got the error message on the vite2 project.
the json file named geo.json that be used to echarts map,
and the json file is so big much.
however, I was rename the json file to geo.js,
and write export default before the file begin,
its working~
Reproduction
System Info
### system
macOS Big Sur v11.6
### binaries
apple m1
### browsers
google chrome v93.0.4577.82
Used Package Manager
yarn
Logs
下午4:55:41 [vite] Internal server error: Failed to parse JSON file.
Plugin: vite:json
File: /Users/xxx/web/src/assets/mock/china.geo.v3.json
at formatError (/Users/xxx/web/node_modules/vite/dist/node/chunks/dep-36bf480c.js:50163:46)
at TransformContext.error (/Users/xxx/web/node_modules/vite/dist/node/chunks/dep-36bf480c.js:50159:19)
at TransformContext.transform (/Users/xxx/web/node_modules/vite/dist/node/chunks/dep-36bf480c.js:75770:22)
at Object.transform (/Users/xxx/web/node_modules/vite/dist/node/chunks/dep-36bf480c.js:50373:53)
at async transformRequest (/Users/xxx/web/node_modules/vite/dist/node/chunks/dep-36bf480c.js:65414:29)
at async viteTransformMiddleware (/Users/xxx/web/node_modules/vite/dist/node/chunks/dep-36bf480c.js:65542:32)
[X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
[X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
Hello @JohnnyLuv. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.
Describe the bug
I was created the vite2 project from create-react-app project, the code is working on the CRA project, but I got the error message on the vite2 project.
the json file named
geo.json
that be used to echarts map, and the json file is so big much.however, I was rename the json file to
geo.js
, and writeexport default
before the file begin, its working~Reproduction
System Info
Used Package Manager
yarn
Logs
Validations