UglifyJs encountered an unexpected character '@'

Upon trying to build my Angular 6 App using ng build ---prod, I encountered the following error:

ERROR in scripts.28e0dfadf7f39e74e940.js from UglifyJs Unexpected character '@' [scripts.28e0dfadf7f39e74e940.js:13,0]

What might be causing this issue?

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}

Answer №1

UglifyJS currently does not have built-in support for ES2015 or newer versions of JavaScript. Additionally, since decorators are not officially included in any ES specification, they also cannot be processed directly by UglifyJS. To use decorators, you will need to transpile them before minification.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Limiting the closure of Angular Material dialogs

Can the closing of an Angular Material Dialog be restricted on any body click? I'm currently working on a project using Angular Material with Angular 4 and I'm looking for a way to achieve this. ...

Angular 15 brings an exciting new feature: the Swiper 9 Element

I went through the swiperjs official documentation found at: swiperjs doc To display images, I created a method to configure and initialize the swiper only when necessary. Below is the HTML code snippet: <swiper-container #swiperRef init="false& ...

What is the best way to dynamically import two css frameworks in React?

Currently, I am involved in a project that requires me to incorporate a button for toggling between Bootstrap and Foundation at the request of my client. After exploring several alternatives, I have determined that utilizing hooks to manage the state of e ...

How can one access DOM elements (getting and setting values) that are nested within an *ngFor loop?

How can I access the <span> and <select> elements in my code template shown below? <div *ngFor="---"> <div> <span></span> <select> <option></option> <option></option> ...

A guide to activating tag selection within the DevExtreme tag box

I'm currently utilizing devExtereme within my Angular project. My goal is to enable the selection of text within tags in my tagbox component. Here's what I have implemented: <dx-tag-box [dataSource]="sourves" [value]="value&quo ...

Add a feature to a functional component that is enclosed with React.forwardRef

Within my codebase, there exists a component that is wrapped with React.forwardRef and serves as a compound component. One challenge I encountered was how to preserve the functionality of Form.Item = FormItem; while still having the Form component fun ...

Learning how to access and interpret incoming data in a Node.js API

I need to access the csv data uploaded to the backend. To do this, I am sending the data via POST from the frontend. Here is the frontend code: fileEvent(e) { this.filedata = e.target.files; if (this.filedata.length > 0) { const file: F ...

The layout of the RadDataForm with nested groups in a GridLayout using NativeScript Angular does not properly display all fields on iOS

In the Angular NativeScript (6.3.0) component, I am facing an issue with XML where the form group expands and shrinks correctly on Android when the group title is tapped. However, on iOS, the group does not expand when using GridLayout rows="auto" and doe ...

What could be causing React to generate an error when attempting to utilize my custom hook to retrieve data from Firebase using context?

Currently, I am restructuring my code to improve organization by moving data fetching to custom hooks instead of within the component file. However, I am encountering issues with the hook not functioning properly when used in conjunction with my context. ...

Creating a declaration file in TypeScript: defining types and interfaces

Could you guide me on creating a declaration file for define(function() { 'use strict'; return Object.freeze({ BTN_LINK: 'btnLink', COMBO_BOX: 'comboBox', TEXT: 'text' }); }); ...

Tips for restricting the signature within a function depending on the argument's value

Trying to consolidate interface methods into a single function with an additional operation parameter. The function can be called as expected, but struggling to narrow the signature within the function. Found some assistance in this SO post, but still enco ...

Error event encountered during development of React.js/Next.js application

When building on my local server everything works fine, but when I try to build on a production Linux server, I encounter the following error: > next build ...

The 'subscribe' property is not available on the type '() => Observable<any>'

File for providing service: import { Observable } from 'rxjs/Rx'; import { Http, Response} from '@angular/http'; import { Injectable } from '@angular/core'; import 'rxjs/add/operator/Map'; @Injectable() export clas ...

Utilizing ASP.NET Core Web API and Angular 2 for Secure Authorization and Authentication

I'm currently working on an Angular 2 application that communicates with a Web API to perform basic CRUD operations. I have some specific questions: Is there a way to create a Login/Register page in Angular 2 using ASP.NET Identity? How can I secure ...

Unlimited Spiral of Angular NGXS Dispatch

I am encountering an infinite loop issue when this component is loading. Does anyone have any suggestions on how to resolve this? import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { Sele ...

Updating validators on Angular reactive form controls as they change

I am working with a reactive form where I need to dynamically adjust the validators for the "password" and "confirm password" fields based on user input. I have set up a subscription to listen for changes in the password field's value, updating the va ...

Firebase is storing object values as 'undefined'

My goal is to retrieve user details from my firebase database while using Ionic and Typescript. Here is how I add a user: addToDatabase(user: User) { let isInstructor = user.isInstructor == null ? false : user.isInstructor; this.afDB.list("/users/").push ...

Exploring the Scope of a Directive within an HTML Element's Event Handler

I devised a custom Directive for utilizing an element as a 'dropzone' with native HTML Drag & Drop functionality. Custom Directive Source Code import { Directive, ElementRef, OnInit, Output, EventEmitter, ViewChild } from '@angular/co ...

Using Angular Material theme with Webpack

In the process of configuring angular material for my Angular (4) application using webpack, I discovered that including a default theme is necessary for it to function properly. One of the recommendations provided in the documentation is to use @import & ...

JS/Docker - The attribute 'user' is not recognized in the context of 'Session & Partial<SessionData>'

I'm attempting to integrate express-session into my Node.js application running within Docker. I've come across several discussions on the topic: Express Session: Property 'signin' does not exist on type 'Session & Partial<Se ...