You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the config file is an ES module in my repo created from a template (can't recall exactly how). __dirname is not available in ES Modules, resulting in the following stack strace
failed to load config from /home/wsl/musical-parameters/vite.config.js
error during build:
ReferenceError: __dirname is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/home/wsl/musical-parameters/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///home/wsl/musical-parameters/vite.config.js?t=1658086233703:13: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 loadConfigFromFile (file:///home/wsl/musical-parameters/node_modules/vite/dist/node/chunks/dep-561c5231.js:62653:31)
at async resolveConfig (file:///home/wsl/musical-parameters/node_modules/vite/dist/node/chunks/dep-561c5231.js:62281:28)
at async doBuild (file:///home/wsl/musical-parameters/node_modules/vite/dist/node/chunks/dep-561c5231.js:43272:20)
at async build (file:///home/wsl/musical-parameters/node_modules/vite/dist/node/chunks/dep-561c5231.js:43261:16)
at async CAC.<anonymous> (file:///home/wsl/musical-parameters/node_modules/vite/dist/node/cli.js:747:9)
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
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 vuejs/core instead.
Describe the bug
The docs for MPA config suggets using
__dirname
in the config file.However, the config file is an ES module in my repo created from a template (can't recall exactly how).
__dirname
is not available in ES Modules, resulting in the following stack strace#6899 has a suitable but it dos not work
I've not provided a PR in case there is more going on.
Reproduction
N/A
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: