TypeStrong / TypeStrong/ts-loader
ts-loader 8.* unable to recognize class variables
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.5k
- Forks
- 439
- Avg merge
- 17h 17m
- Merged PRs (30d)
- 2
Description
Hi when I try to import my test.ts class it throws an error saying additional loader is needed for the class variable options(see blow)
Module parse failed: Unexpected token (3:11)
File was processed with these loaders:
* ./node_modules/ts-loader/index.js
You may need an additional loader to handle the result of these loaders.
| import { EventEmitter } from "events";
| export class TestClass extends EventEmitter {
> options;
| constructor(data) {
| super();
@ ./src/backend/electron/electron.ts 5:0-50 37:25-36
@ multi ./src/backend/electron/electron.ts
This is what I am getting from the console when trying to run the app.
Code example:
import { EventEmitter } from "events";
export class TestClass extends EventEmitter {
options: object;
constructor() {
super();
this.options = {
data: data
};
}
}
I am unsure why this is causing an issue.
Some extra info:
I am using this in conjunction with vuejs 2, electron and vuetify.
I had to download my ts-loader to 8 to support webpack 4.
if anymore information is needed I will provide.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the class-field syntax in test.ts and the ts-loader 8 output for src/backend/electron/electron.ts, then inspect the webpack 4 and ts-loader configuration. Done means the example compiles without the additional-loader parse error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, webpack
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100