Error: Optimization error [main.550194cbbf590585.js]: Error: Transform failed with 1 error
Which @angular/* package(s) are the source of the bug?
core, Don't known / other
Is this a regression?
No
Description
I tried several times, in different ways, to deploy my study project (I mean, it's a final exam), to present to my teacher. And I come across several problems when running ng build in the terminal.
Please provide a link to a minimal reproduction of the bug
ng build
Please provide the exception or error you saw
Error: Optimization error [main.d56c20d2349b5960.js]: Error: Transform failed with 1 error:
main.d56c20d2349b5960.js:66765:49: ERROR: Syntax error "d"
at failureErrorWithLog (/home/leonardo/Projects/projeto-loja-virtual-faculdade/front-end-angular/node_modules/esbuild/lib/main.js:1602:15)
at /home/leonardo/Projects/projeto-loja-virtual-faculdade/front-end-angular/node_modules/esbuild/lib/main.js:1391:29
at /home/leonardo/Projects/projeto-loja-virtual-faculdade/front-end-angular/node_modules/esbuild/lib/main.js:665:9
at handleIncomingPacket (/home/leonardo/Projects/projeto-loja-virtual-faculdade/front-end-angular/node_modules/esbuild/lib/main.js:762:9)
at Socket.readFromStdout (/home/leonardo/Projects/projeto-loja-virtual-faculdade/front-end-angular/node_modules/esbuild/lib/main.js:632:7)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
Please provide the environment you discovered this bug in (run ng version)
[leonardo@fedora (dev *%)] - ~/Projects/projeto-loja-virtual-faculdade/front-end-angular
$ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 13.3.3
Node: 16.14.2
Package Manager: npm 8.5.5
OS: linux x64
Angular: 13.3.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1303.3
@angular-devkit/build-angular 13.3.3
@angular-devkit/core 13.3.3
@angular-devkit/schematics 13.3.3
@angular/cli 13.3.3
@schematics/angular 13.3.3
rxjs 7.4.0
typescript 4.5.5
[leonardo@fedora (dev *%)] - ~/Projects/projeto-loja-virtual-faculdade/front-end-angular
$
Anything else?
No response
Unfortunately without a reproduction this won't be actionable. The error occurs during optimization of the output JS bundle by esbuild, which fails to parse the source of the bundle causing the error. It is unclear where this syntax error is introduced or whether this is perhaps a parser bug in esbuild.
Updating: Project that I'm having problem: https://github.com/leonardon397/prova-ecommerce-faculdade-av1. This is in Brazilian Portuguese...
This fails due to the usage of the d regular expression flag (see hasIndices tc39 proposal) in validarEmail in /src/app/services/funcoesParaValidacao.ts, which is not supported by esbuild.
JoostK very very very thank you! Finally I managed to build!!!
This repository that I putted the link above, is my exam of my college.
I've used, initially VSCode as editor. After, I've used WebStorm and I've continued until the moment. Both with SonarLint extension/plugin. WebStorm opens a list of "ctrl + spacebar", to suggest me a list of REGEX, to which it suggested the "i" for "Ignore Case", "g" for "Global Match", "m" for "Multiline ", "d" for "Match Indices", anyway... Then I used "CTRL + spacebar" in WebSorm, to see the options and then use them... Note: I have a student subscription to use JetBrains IDE's.
I thought that there might not be anything wrong until then, because even SonarLint (as WebStorm internal Lint + ESLint) did not report any possible errors....
My professor greatly underestimates people who are students. He thinks that we're learning web development from scratch, INSIDE THE COLLEGE, and he thinks that, in less than 5 months, there's time to completely full learn HTML, CSS, JavaScript and PHP... My idea in using this wonderful framework is exactly to show him that he underestimates his students too much.
This is only basic, I used many variables in portuguese (instead of in english), for the requirements of my professor.
If someone is hading the same proble, I created a functions to validate e-mail with regex /^[a-z\d\-._+&#]+@[a-z]+(.[a-z]{2,8})+$/di instead of /^[a-z0-9\-._+&#]+@[a-z0-9]+(.[a-z]{2,8})+$/i (in final, /d isn't supported by ES Build...
I closed the issue. If necessary to open again, I hope can help!
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.