Support `mts` / `cts` / `cjs` config files
See original GitHub issueClear and concise description of the problem
Import ESM-only package in vitest.config.ts
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/kevin/Developer/open-source/unplugin-jsx-string/node_modules/estree-walker/package.json
If I change extname to mts
, Vitest can’t find and load this config file.
Suggested solution
export const configFiles = [
'vitest.config.ts',
+++ 'vitest.config.mts',
+++ 'vitest.config.cts',
'vitest.config.js',
'vitest.config.mjs',
+++ 'vitest.config.cjs',
'vite.config.ts',
+++ 'vite.config.mts',
+++ 'vite.config.cts',
'vite.config.js',
'vite.config.mjs',
+++ 'vite.config.cjs',
]
Alternative
No response
Additional context
I will try to make an PR to implement it.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that request the same feature to avoid creating a duplicate.
Issue Analytics
- State:
- Created a year ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Support `mts` / `cts` / `cjs` config files · vitest-dev/vitest ... - GitHub
A Vite-native test framework. It's fast! Contribute to vitest-dev/vitest development by creating an account on GitHub.
Read more >Documentation - ECMAScript Modules in Node.js - TypeScript
Node.js supports a new setting in package.json called type . ... In turn, TypeScript supports two new source file extensions: .mts and .cts...
Read more >`.mts` is a cool file extension (TypeScript ES modules)
js supports two extensions to help with this: .mjs and .cjs . .mjs files are always ES modules, and .cjs files are always...
Read more >Content Types - ESBuild
This loader is enabled by default for .js , .cjs , and .mjs files. ... .tsx , .mts , and .cts files, which...
Read more >How we employed the new ECMAScript Module Support in ...
You can also exempt files from this behavior by using special extensions. .mts and .cts are the TS equivalents of .cjs and .mjs...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
After #1541
You can open PR to both 😛