-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
Yes
Description
The following code (notice the symbols ‘
and ’
):
'‘The year is 2019’'.replace(/[\‘\’]/g, '')
will produce 'The year is 2019'
in development mode (expected), but '‘The year is ’'
in production mode (unexpected).
The ‘
and ’
are \u2018
and \u2019
so I guess Angular somehow transformed them to plain text in production mode, I think that is the reason.
After migrating my project from Angular 4 to 12, I found this issue, it didn't happen in Angular 4, but not sure it happened since which version.
In the point of view of regular expression, the ‘
and ’
are not special symbols like .
or *
, so it doesn't need \
, it means/[‘’]/g
is enough, and when using like that the issue will not happen. But anyway, I think the issue is kind of serious for me, because developers will be surprised when seeing the result in production mode.
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/angular-ivy-zwf1us
It also happens in ng serve --configuration=production
, so you can quickly reproduce the issue.
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version
)
Angular CLI: 12.2.1
Node: 16.6.2 (Unsupported)
Package Manager: npm 7.20.3
OS: darwin arm64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1202.1 (cli-only)
@angular-devkit/core 12.2.1 (cli-only)
@angular-devkit/schematics 12.2.1 (cli-only)
@schematics/angular 12.2.1 (cli-only)