-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Failed to compile main process with typescript 4.3 and class private fields #1432
Comments
Example repo is a simple project from
What I figured out that helps so far:
But upgrading to vue-cli 5 beta and so webpack 5 didn't help. For better clarity here are the differences in TS emit with TS 4.3 and target export class Foo {
bar = "";
getBar() {
return this.bar;
}
} TS 4.3 and target export class Foo {
constructor() {
this.bar = "";
}
getBar() {
return this.bar;
}
} TS 4.2 and target export class Foo {
constructor() {
this.bar = "";
}
getBar() {
return this.bar;
}
} Issues I found so far that might be related: TypeStrong/ts-loader#1054 and webpack/webpack#10216 I wonder if that's some upstream issue of webpack, ts-loader, babel or vue-cli-plugin-typescript. What's puzzling is why |
I'm not sure what exactly is causing this error, seems like a bug in typescript/ts-loader. I think it works in the Vue files because vue cli uses ts-loader and babel on those, whereas the main process is just typescript. If you want to use babel on the main process too, use this config: // vue.config.js
module.exports = {
lintOnSave: false,
pluginOptions: {
electronBuilder: {
chainWebpackMainProcess: config => {
config.module
.rule('babel')
.before('ts')
.use('babel')
.loader('babel-loader')
.options({
presets: [['@babel/preset-env', { modules: false }]],
plugins: ['@babel/plugin-proposal-class-properties']
})
}
}
}
} That fixes the error you get. |
Describe the bug
After upgrading TypeScript to 4.3.x main process bundle no longer builds if there's a class with private field.
To Reproduce
Steps to reproduce the behavior:
yarn install
yarn electron:serve
oryarn electron:build
Expected behavior
Main process bundle builds fine.
Actual behavior
Environment (please complete the following information):
vue info
:Additional context
There's also same class with private field inside
App.vue
and bothyarn serve
/yarn build
complete just fine.The text was updated successfully, but these errors were encountered: