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
Using the typescript format for a postcss config, ts-node does not respect the tsconfig.json target and transpiles the import syntax to require() resulting into an error with "type": "module" in package.json.
Workaround: change it from .postcssrc.ts to .postcssrc.js
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: ...\.postcssrc.ts
require() of ES modules is not supported.
require() of ...\.postcssrc.ts from ...\node_modules\vite\dist\node\chunks\dep-bb8a8339.js is an ES module file as it is a .ts file whose nearest parent package.json contains "type": "module" which defines all .ts files in that package scope as ES modules.
Instead change the requiring code to use import(), or remove "type": "module"from ...\package.json.
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
Using the typescript format for a postcss config,
ts-node
does not respect thetsconfig.json
target and transpiles theimport
syntax torequire()
resulting into an error with"type": "module"
inpackage.json
.Workaround: change it from
.postcssrc.ts
to.postcssrc.js
Reproduction
https://stackblitz.com/edit/vitejs-vite-l8rdtt
Steps to reproduce
Just use this config in a file called
.postcssrc.ts
:System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: