-
-
Notifications
You must be signed in to change notification settings - Fork 303
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
Unable to use @web/dev-server-esbuild#0.3.0 with TS and lit #1929
Comments
This is likely an issue with esbuild, and/or your configuration. The plugin is just a passthrough. |
Mine configuration is pretty much what's in the @open-wc init with addition of // import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
import { esbuildPlugin } from '@web/dev-server-esbuild';
import LocalApiStore from './demo/store/StorePlugin.js';
/** Use Hot Module replacement by adding --hmr to the start command */
const hmr = process.argv.includes('--hmr');
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
open: '/demo/',
/** Use regular watch mode if HMR is not enabled. */
watch: !hmr,
/** Resolve bare module imports */
nodeResolve: {
exportConditions: ['browser', 'development'],
},
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
// esbuildTarget: 'auto'
/** Set appIndex to enable SPA routing */
// appIndex: 'demo/index.html',
plugins: [
esbuildPlugin({ ts: true, target: 'auto' }),
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
LocalApiStore,
],
// preserveSymlinks: true,
// See documentation for all available options
}); I also didn't change much in the tsconfig file: {
"compilerOptions": {
"target": "es2018",
"module": "esnext",
"moduleResolution": "node",
"noEmitOnError": true,
"lib": ["es2017", "dom"],
"strict": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"importHelpers": true,
"outDir": "dist",
"sourceMap": true,
"inlineSources": true,
"rootDir": "./",
"declaration": true,
"incremental": true
},
"include": ["**/*.ts"]
} |
Some System information:
I'm having a similar issue with version Also the issue disappears when I downgrade the version to I don't think it's an issue with the esbuild plugin. But surely some strange things are happening. From version In version When one upgrades the esbuild plugin to I have created a repository where one can see that something strange is happening when the https://github.com/jordimarimon/esbuild-test-server-decorators Steps to reproduce:
Change the
When working with Lit, the decorators that don't have a descriptor, a default descriptor is created: See: https://github.com/lit/lit/blob/main/packages/reactive-element/src/reactive-element.ts#L648 The default descriptor adds an instance field prefixed with two underscores and a prototype field. This seems to not be the case in chromium when using the latest version of Things start getting stranger when I serve a demo page with an output generated with the latest version of To reproduce this last case:
Also when I execute the tests, it does pass in Firefox and Webkit. If this was an error in the latest version of The problem is only visible in Chromium with the latests versions of I really don't know why this is happening. I'm aware that this is not an issue with the But it can't also be an issue with the latest version of Sorry to post it here because probably it doesn't have anything to do with the esbuild plugin but because I found it related, I want it at least to share it here. I'm going to continue to research what is happening. |
I had the same problem. Change the target from "auto" to a specific ECMAScript version, e.g. "es2017". It's needed because of a change in ESBuild.
|
I think this issue could also be fixed with #1921 and setting useDefineForClassFields to |
Indeed, that issue and PR were instigated by this very problem. :) |
In my repo of base UI components (which was affected by this) I heavily used mixins. I believe this was causing the problem. It took me a while but it refactored the library to replace these mixins with classes and proper inheritance chain. I upgraded the version of |
@jarrod Are you sure changing |
No, this didn't make the difference. I changed the entire code base to avoid mixins, I redesigned how elements inherit properties, and I am now avoiding a situation where a property is set on a derived class that shadows parent property. At least I thought it was working. It was working in demo pages and tests but when I published the library and started using it in another project I couldn't make it work. Property setters didn't work. Only when I called a function that also sets a property in the parent class it started partially working. Eventually, I reverted to |
Some weird thing happened today. I updated dependencies and the project stopped working again. class A {
constructor() {
this.a = 2;
}
} While the generated by the esbuildPlugin / esbuild code is similar to this: class A {
a = 2;
} This naturally causes the class to not respect decorated properties as the Edit: |
We need to downgrade it: IBM/pwa-lit-template#516 |
We need to downgrade the |
We also had this problem with the error message
according to https://github.com/modernweb-dev/web/blob/master/packages/dev-server-esbuild/CHANGELOG.md#031 |
Related to lit/lit#2716
After updating to version 0.3.0 I started seeing errors related to the use of decorators. I was able to pinpoint the problem to the update of the
@web/dev-server-esbuild
library in my projects. I was able to run my projects again after downgrading to version0.2.16
.Please, refer to the referenced issue for more details.
The text was updated successfully, but these errors were encountered: