-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
Support ESM Syntax in config files #509
Comments
The is TS around in the dep tree, could transpile JS to common JS with it? ( |
I gave it a try and I am not confident that this can be resolved at this point without something that feels like a hack. The current Electron (which powers VS Code) is at Node 12.x, so no native ESM support. This means we need to transpile the language-server code with What's left (that I know of) is import { register } from 'ts-node';
// inside a custom cosmiconfig loader function:
const loader = (filePath: string) => {
// ...
register({
transpileOnly: true,
compilerOptions: { module: 'CommonJS', esModuleInterop: true, allowJs: true },
skipProject: true
});
// ... Once |
Could something like this be used to get around the limitation of VS Code using an Electron powered by Node 12 (seriously vs code team...node 14 has been LTS for almost a year now :D)? This way is super hacky though, so I agree, I'm not sure it can be resolved at this point with a way that doesn't feel like a hack. |
why not just using for reference: https://github.com/windicss/windicss-intellisense/blob/b44056cad99cbe7819e6e765717ea154075d186f/src/lib/core.ts#L25 |
Like mentioned above, |
Ok cool. Strange it seems it does not has any issues with ts for us |
Because your compile target isn't commonjs from what I can see. |
Is your feature request related to a problem? Please describe.
Config files need to be written in node-commonjs-style (no
import ...
orexport const ...
syntax) because we userequire
inside our extension to dynamically load dependencies. This is confusing to users and not obvious.Describe the solution you'd like
Change the setup so that ESM syntax is supported.
await import(...);
syntax, which is problematic becausesvelte-preprocess
is looked up insideDocument
creation. That can't be made asynchronous because it's used inside the TS LS (same problem as for Bug: DocumentSnapshot.ts is not passing preprocessed markup to svelte2tsx #339 ).svelte-preprocess
-call out ofDocument
and into the start of the application. This would be a breaking change as you now can only have one top-levelsvelte.config.js
and not multiple at different levels - but I doubt this will break anyone, and it would also align more with the semantics of other config files (only one per project).Help and other ideas highly appreciated
The text was updated successfully, but these errors were encountered: