-
-
Notifications
You must be signed in to change notification settings - Fork 298
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
Confirm compatibility between @rollup/plugin-typescript and @web/dev-server #2168
Comments
With |
The downside is that esbuild doesn't do any type checking, it only strips types. The biggest issue is the gap between TypeScript and esbuild. If TypeScript is used in the production environment and esbuild is used in the development environment, it will inevitably result in unexpected differences, and the two are not well compatible. Esbuild does not support types and only supports a limited number of tsconfig.json configurations. In the end, I used |
I've just used the TypeScript compiler as part of an LSP in my editor and then as part of the CI/CD process by adding a I'm curious to what else you'd like TypeScript to do in a development server. |
The
Development environment: "@web/dev-server-esbuild": "^0.3.4",
"rollup": "^3.19.1",
"@web/dev-server": "^0.1.36", tsconfig.json {
"compilerOptions": {
...
"module": "es2022",
"target": "es2022",
"strict": true,
"lib": ["es2022", "dom", "dom.iterable"],
"experimentalDecorators": true,
"useDefineForClassFields": false,
},
} I found related documentation for esbuild:
Lit code: @customElement('my-two')
class Two extends LitElement {
@property()
firstName: any;
render() {
return html`<p class="text-green-600">Hello, ${this.firstName}!</p>`;
}
}
@customElement('my-element')
class One extends LitElement {
render() {
return html`
<p class="text-red-500 bg-purple-400">Hello from my template.</p>
<my-two .firstName="${8888}"></my-two>
`;
}
} |
useDefineForClassFields should be supported, iirc you also have to set the esbuild target for it to work |
I set |
@jpzwarte dont you have a ts+wds/esbuild setup running? Could you share your setup? |
My minimal demo library. https://github.com/ouweiya/esbuild-dev-server |
I know the reason why configure doesn't work. https://modern-web.dev/docs/dev-server/plugins/esbuild/#examples
|
In the end, I've decided to give up on using esbuild and continue with tsc instead, as it requires focusing on too many details for both, especially when using two different TypeScript compilers for the same codebase. The hidden development costs of this approach far outweigh the convenience brought by @web/dev-server. Thank you to those who have helped me; you have all been very enthusiastic and friendly. I appreciate your assistance. |
The documentation mentions that @rollup/plugin-typescript does not work properly. However, after trying to use @rollup/plugin-typescript in @web/dev-server, I found no errors and it seems to work as expected.
Here is the code:
Is this due to an update in the packages, but the documentation has not been updated yet?
Or is it because some features of TypeScript are not supported?
The problem encountered at the moment is that during the development process, TypeScript compilation is slower than page refresh, causing the page to display data from the previous iteration.
The text was updated successfully, but these errors were encountered: