ng run [project-name]: app-shell
x)
- [x] generate
- [x] run
This is not duplicate of #8848 .
When I run ng run [project-name]:app-shell
I get Unexpected token export error
Cli even does noes not inform in which file is the problem. So have no clue where to debug.
Tried --verbose but is not supported with this command.
I get no erorrs with ng-build --prod and ng run project-name:build.
Configured app shell with steps;
ng run [project-name]: app-shell builds and exports two builds in dist (dist/project-name and dist/project-name-server) but I do not see app-shell in dist/project-name/index.html
Thanks in advance
https://github.com/vugar005/app-shell-unexpected-token
Unexpected token export without additional details.
@angular-devkit/architect 0.801.2
@angular-devkit/build-angular 0.801.2
@angular-devkit/build-optimizer 0.801.2
@angular-devkit/build-webpack 0.801.2
@angular-devkit/core 8.1.2
@angular-devkit/schematics 8.1.2
@angular/cdk 8.1.1
@angular/cli 8.1.2
@angular/material 8.1.1
@angular/material-moment-adapter 8.1.1
@ngtools/webpack 8.1.2
@schematics/angular 8.1.2
@schematics/update 0.801.2
rxjs 6.4.0
typescript 3.4.5
webpack 4.35.2
Also tried with
"@angular/cli": "~8.2.0-rc.0.",
"@angular/compiler-cli": "~8.2.0-next.1",
but same problem.
Hi, the problem seems to be that some of your dependencies don't have a UMD bundles.
Example: countup.js
This is related to the following issue: https://github.com/angular/angular-cli/issues/13181
That being said, we should display the module that is causing the problem so that users can track and action the issue quicker.
@alan-agius4 Thank u for quick response. But why ng run plus-minus:server:production andng run plus-minus:build:production does not produce that problem?
The issue is that code is executed when running ng run [project-name]:app-shell that particular code is not compatible to be executed on Node to generate the Application shell.
ng run plus-minus:build:production works because the dependencies gets bundled and eventually the export syntax is removed.ng run plus-minus:server:production doesn't fail because the code doesn't get executed but only built, However it will eventually fail when you try to execute it on the server.@alan-agius4 Thank u. The problem was with countup.js-angular2 plugin. Removed and problem was solved. But I think it is very useful that CLI notify which package causes this problem. Thanks in advance.
Just had this issue as well. It would really be useful to get some stacktrace of the error, which I figured I can get by going to the dist folder where the main.js server file is generated and simply run node main, but this is not really obvious and many people can get frustrated.
We are trying to implement the app-shell in our product, and when we tried to build the app, it generated the same error Unexpected token export without extra information. Unfortunately, unlike the app in this issue, We have tons of dependencies and we don't know which ones causing the issue. It would be good to provide extra information and let the user know what causing the issue
@DanielYKPan Try running node main.js file in serverdist. It will show the exact library that causes the error.
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.
If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.
Most helpful comment
The issue is that code is executed when running
ng run [project-name]:app-shellthat particular code is not compatible to be executed on Node to generate the Application shell.ng run plus-minus:build:productionworks because the dependencies gets bundled and eventually theexportsyntax is removed.ng run plus-minus:server:productiondoesn't fail because the code doesn't get executed but only built, However it will eventually fail when you try to execute it on the server.