Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

启动出现错误 #3

Open
MulatramAwA opened this issue Dec 9, 2023 · 2 comments
Open

启动出现错误 #3

MulatramAwA opened this issue Dec 9, 2023 · 2 comments

Comments

@MulatramAwA
Copy link

我npm i后使用npm start时发生错误:

> xviewer-react-template@1.0.0 start
> vite --host

▲ [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:\Users\nkliu\Desktop\www-genshin\vite.config.js
error when starting dev server:
ReferenceError: exports is not defined in ES module scope
    at file:///C:/Users/nkliu/Desktop/www-genshin/vite.config.js.timestamp-1702126836837-56264ac4324cb.mjs:10:23
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadConfigFromBundledFile (file:///C:/Users/nkliu/Desktop/www-genshin/node_modules/vite/dist/node/chunks/dep-68d1a114.js:66329:21)
    at async loadConfigFromFile (file:///C:/Users/nkliu/Desktop/www-genshin/node_modules/vite/dist/node/chunks/dep-68d1a114.js:66178:28)
    at async resolveConfig (file:///C:/Users/nkliu/Desktop/www-genshin/node_modules/vite/dist/node/chunks/dep-68d1a114.js:65774:28)
    at async _createServer (file:///C:/Users/nkliu/Desktop/www-genshin/node_modules/vite/dist/node/chunks/dep-68d1a114.js:65051:20)
    at async CAC.<anonymous> (file:///C:/Users/nkliu/Desktop/www-genshin/node_modules/vite/dist/node/cli.js:763:24)

我试图解决但似乎没有变化,希望帮我解决。

@MulatramAwA
Copy link
Author

我在尝试修改代码,如果成功我会提交PR

@MulatramAwA MulatramAwA closed this as not planned Won't fix, can't repro, duplicate, stale Dec 9, 2023
@MulatramAwA MulatramAwA reopened this Dec 9, 2023
@MulatramAwA
Copy link
Author

经检查是vscode配置问题,使用cmd正常运行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant