-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot investigate ng build --prod UglifyJs failure #5741
Comments
I believe this was caused by a module I was importing ('text-mask-core') which used default parameters in the source. I was importing directly from the module's src folder instead of the dist which is compatible. However, this was basically fixed by accident for me and I think it would be good if the error message was improved help investigate these kind of issues. |
Same issue. I may have a bad import but I can't tell because the UglifyJs error refers to a file that's never saved, I have no dist folder after this output. This also started for me after upgrading to cli 1.0 and angular 4.0
|
I've had this error some time ago. This fixed it for me: adding/replacing the uglify-js dependency in package.json: "uglify-js": "github:mishoo/UglifyJS2#harmony" NB: the "unexpected token operator" mentioned in the error is arbitrary. |
I agree that it would be good to have better errors for this sort of stuff, but that's what UglifyJS gives us. Maybe we can replace it with something else in the future. |
If you add the sourcemaps flag, e.g. |
For me helps @calbot solution. I also have used text-mask-core source code instead of dist (utilities have many useful functions). |
@steveschmitt ah of course, I didn't think of that at all. |
When I run global [email protected] File tsconfig.json:
File tsconfig.app.json:
Can somebody explain why is this happening? |
Try the source map option which was mentioned earlier to see where the
error came from.
…On 24 May 2017 at 12:47, yaahor ***@***.***> wrote:
When I run global ***@***.*** ng build -prod, then building
complete successfully. But when I try to run local ***@***.*** node_modules\.bin\ng
build -prod, then error is thrown ERROR in vendor.c6a3588f344ea41b381f.bundle.js
from UglifyJs Unexpected token: name (Simple) [vendor.c6a3588f344ea41b381f.
bundle.js:8858,6].
File tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
***@***.***"
],
"lib": [
"es2016",
"dom"
]
}
}
File tsconfig.app.json:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
Can somebody explain why is this happening?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5741 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHywlJAQzJzNhcJtA2x1GdRQfkzgo2Riks5r9IlbgaJpZM4MtkQ9>
.
|
Line 9 of file ./~/cbor/lib/simple.js: "cbor" is dependency of "autobahn" library what is used in my project. |
If you use the Thanks to this comment |
@smac89 What does the sm flag do? |
|
Lol that makes sense. I can probably figure out how to add source map to
webpack config prod mode.
…On Aug 5, 2017 2:10 AM, "Filipe Silva" ***@***.***> wrote:
-sm is the alias for --sourcemap.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#5741 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AX5Xbs3xzn-VmaAChSdmZWhRx4YtbZRIks5sVDGDgaJpZM4MtkQ9>
.
|
Brilliant advice about |
@kirillgroshkov You can try replacing the
It's an experimental version of Uglify that works with ES6. |
A use angular cli but i have no |
i have same issues, i remove node_modules, then npm install again, and success |
You should be able to just remove |
Yes,remove node_modules folder. I've tried just now. i build use 'npm run build -- --prod' |
Using |
Hi,
I'm targeting es6, so I add the following dev-dependencies, clear the modules and reinstall... but I still have the error.
If someone has an idea to help me, it's welcome. |
@steveschmitt trick of using --sm to generate the source map provided the clue that my ngx-infinite-scroll had an issue. Prior to the uglify-js error I was having a problem when building ngx-infinite-scroll that it could not find index.js so I moved the node_modules/ngx-infinite-scroll/modules/ngx-infinite-scroll.js to node_modules/ngx-infinite-scroll/index.js For me, the would have been fine because my tsconfig.json target was es2015, but for other reasons I changed my tsconfig.json to target es5 and needed to go back and move node_modules/ngx-infinite-scroll/modules/ngx-infinite-scroll.es5.js to node_modules/ngx-infinite-scroll/modules/index.js. Once I did that change the below uglify error went away. |
I was having this problem as well And solved it by first looking into the sourcemaps (ng build --prod --sm), as suggested by @steveschmitt) which led me to discover that it was a problem with the generatorics npm package
I removed the package, and problem solved! |
i have no "uglify-js" in my package.json to replace what should i do ?? |
@fabien-chevalley did you find any solution ? i applied the sugestions above but seems like uglify-js is still used |
@steveschmitt i can't find "uglify-js" in package.json because it's a nested dependency of angular-cli though just adding it doesn't change anything for the most of us. |
I think I installed the experimental uglify-js at the top level, and
removed the nested one, and it just worked. Recent npm versions won't
install a nested package if you already have a compatible version installed
at the top level.
Steve
…On Oct 20, 2017 8:59 PM, "Youssef GHOUBACH" ***@***.***> wrote:
@steveschmitt <https://github.com/steveschmitt> i can't find "uglify-js"
in package.json because it's a nested dependency of angular-cli though just
adding it doesn't change anything for the most of us.
Any idea ? maybe you use a specific version of angular-cli that doesn't
nest uglify-js ?
Thanks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5741 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABmCtms80kvLH9QL8hiA6XPgD8uDrKVsks5suLxNgaJpZM4MtkQ9>
.
|
@youssefgh I try to move on Angular-Cli 1.5 to have the following modification #7610, the production build is now working, but I'm not able to serve my application #7797 anymore... So I didn't have any solution for the moment |
I moved to cli 1.5.0-rc.2 as a workaround until 1.5 is released
Thanks a lot guys for you help ;) |
I got the same issue using 1.5. I tried both
|
@ShinDarth i no longer have this issue using 1.5 and even without using --aot. I think you have a different problem |
@youssefgh I did it, in my case it's not a lib but my source code |
@ShinDarth then (i think) just changing the es6+ syntax in your code to a ES2015 compliant should resolve your problem see above comment :
|
yes I used
|
That is weird that a simple class in an angular project can cause this |
@youssefgh I'm not able to reproduce the problem in other projects. Actually I'm even having troubles in reproducing it with the same project across different machines... |
I solved mine by removing repeated codes inside my assets folder. |
For those interested in Angular CLI v6.* the flag is now For me, source maps helped me identify a trailing comma in my function parameters that was breaking uglifyJS 🤷♂️. |
Hello , Here is the error i face after running ng build --prod. ERROR in 10.ef56b443a514b22853bd.chunk.js from UglifyJs |
I had following error,
and it is fixed with |
Update: Only with
If I build my app, I am getting
If I use
So that's that. I have already removed |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Versions.
Repro steps.
I run...
ng build --prod
But uglify fails and there's no way to investigate it because the dest folder isn't created on this failure. Specifically trying to investigate Unexpected token operator «=», expected punc «,» .
The log given by the failure.
Desired functionality.
Would like some more context. The intermediate files should not be deleted on an UglifyJs failure because there's not much to go on.
Mention any other details that might be useful.
This error started for me today after I tried to update to angular 4 and the new angular cli.
The text was updated successfully, but these errors were encountered: