Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

535
Views
Module parse failed: Unexpected character '#' in an Angular Project

I am getting this error when I try to use private fields in an Angular Project.

Error: ./src/app/_helpers/sample.js 6:11
Module parse failed: Unexpected character '#' (6:11)
File was processed with these loaders:

./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
./node_modules/@ngtools/webpack/src/ivy/index.js
./node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.

sample.js file:

class Sample {

constructor() {
   this.#reloadConfig(); // 6th line
}

#reloadConfig() {
}

EDIT: Was able to resolve it by upgrading Angular from 11 to 12, seems Angular 11 doesn’t support private methods declared in a JS file.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You just need to use private keyword and remove the #

class Sample {
   constructor() {
      this.reloadConfig();
   }

   private reloadConfig() {
   }
}

TypeScript’s private-declared properties work with all targets — even ECMAScript 3! — Microsoft DevBlog

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!