Attempting to use vite for the first time. Did npm create vite@latest to generate a react typescript project. Ran npm install then tried npm run dev and got the following error.
> vite-test@0.0.0 dev
> vite
▲ [WARNING] The CommonJS "exports" variable is treated as a global variable in an ECMAScript module and may not work as expected [commonjs-variable-in-esm]
vite.config.js:6:0:
6 │ exports.default = (0, vite_1.defineConfig)({
╵ ~~~~~~~
This file is considered to be an ECMAScript module because the enclosing "package.json" file sets
the type of this file to "module":
package.json:5:10:
5 │ "type": "module",
╵ ~~~~~~~~
Node's package format requires that CommonJS files in a "type": "module" package use the ".cjs"
file extension.
failed to load config from C:\Dev\vite-test\vite.config.js
error when starting dev server:
ReferenceError: exports is not defined in ES module scope
at file:///C:/Dev/vite-test/vite.config.js.timestamp-1668297720894.mjs:10:23
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
at async loadConfigFromBundledFile (file:///C:/Dev/vite-test/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:62827:21)
at async loadConfigFromFile (file:///C:/Dev/vite-test/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:62712:28)
at async resolveConfig (file:///C:/Dev/vite-test/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:62336:28)
at async createServer (file:///C:/Dev/vite-test/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:61636:20)
at async CAC.<anonymous> (file:///C:/Dev/vite-test/node_modules/vite/dist/node/cli.js:707:24)
Link to Minimal Reproducible Example
No response
Participation
[ ] I am willing to submit a pull request for this issue.
What version of
vite
are you using?vite@latest
System info and storybook versions
Windows 10 64bit ryzen 5950x
Describe the Bug
Attempting to use vite for the first time. Did npm create vite@latest to generate a react typescript project. Ran npm install then tried npm run dev and got the following error.
Link to Minimal Reproducible Example
No response
Participation