-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
feat: supports cts and mts config #8729
Conversation
✅ Deploy Preview for vite-docs-main ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed this filter needs to be /\.[mc]?[jt]s$/
now.
vite/packages/vite/src/node/config.ts
Line 959 in 9d16253
build.onLoad({ filter: /\.[jt]s$/ }, async (args) => { |
For example, this code does not work.
// vite.config.mts
import { u } from './foo.mjs'
console.log(u) // expected: 'file://path/to/foo.mjs', actual: `ReferenceError: __vite_injected_original_import_meta_url is not defined`
// foo.mjs
export const u = import.meta.url
@sapphi-red |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Can I backport this feature to 2.x branch? |
It's added in Vite 3.0: vitejs/vite#8729
It's added in Vite 3.0: vitejs/vite#8729
I don’t think this fully addresses #5201—this only supports
|
Yeah looks like this covers config files only. We should support source files too. Re-opening the issue. |
Description
Support
mts
/cts
/cjs
config filescloses #5201
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).