We successfully upgraded our Angular application from version 11 to version 17, tested the functionality, and took a dev build. However, we are currently using the command ng build --configuration production
to take production builds, and we are encountering the following problems. Any advice or assistance would be much valued.
We are using the below method to validate the inputs and remove the special characters
escapeRegExp(value: string): string {
return value.replace(/[{}()^$&%#!@=<>:;,~`'’*"?/+|[\\]|]/g, '');
}
Now the problem is, while building the application in production mode with the below configuration, ’
is getting relaced as u2019
. That means the above method is converted as below in the minified main.js
file
escapeRegExp(o){return o.replace(/[{}()^$&%#!@=<>:;,~`'\u2019*"?/+|[\\]|]/g,"")}
Below is the configuration we are using for production build.
"configurations": {
"production": {
"optimization": true,
"outputHashing": "none",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
}
}