-
Notifications
You must be signed in to change notification settings - Fork 12k
App-shell devkit builder doesn't support ES6 imports #13181
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
Comments
Hi, this is due that when building an App-Shell, it uses the server build which needs to be compatible with a Node environment and it happens that ES6 imports aren't. Unfortunately, Angular CLI itself, doesn't do downleveling of javascript. |
The |
This is very similar to #12975 (comment), insofar as we do not error if es6 libraries are used when targetting es5. |
We should bundle the third-party dependencies with webpack so that it transpiles the ESModule syntax |
Let's meet and decide how to document this and how to setup the app-shell schematics. |
I have tried to use The seems to be related that Should be addressed in #12273 |
What if there was an option to do an app shell build without the server build? For the use-case of pre-rendering the app shell and serving it from a CDN. |
@ca136, to generate the app-shell, the code needs to executed by the build pipeline which runs in node, and thus the application needs to be server compatible. |
@vikerman I remember you were looking at this error #13181 (comment). Any updates? |
Just ran into this exact issue. Glad to see that it's a known problem. Hopeful for a resolution someday soon. |
Using
However, when app shell is involved, this doesn't work. I'm able to fix the exception by adding code directly to generated Is there a way the fix with domino can be used in app-shell? |
@vikerman @alan-agius4 Is there any way to only prerender the app-shell component but prevent the builder from rendering the first route ? This way it won't cause the error if components that contain ES6 library don't render. |
@phetw, in this case it doesn't matter which component to render, as it will fail during parsing not execution. Can someone please verify it this issue is still present in version 9? Thanks. |
Thanks for reporting this issue. This issue is now obsolete due to changes in version 9. 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. |
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
)Command (mark with an
x
)Versions
node v10.11.0
npm 6.4.1
ng 7.1.2
macOS Mojave / High Sierra
Repro steps
ng generate app-shell --client-project shell-error --universal-project shell-error
npm install --save lodash-es
ng run shell-error:app-shell
The log given by the failure
Desired functionality
Should be able to build the app shell with es6 imports.
Mention any other details that might be useful
It looks like there might be a webpack loader or a build step missing for the app-shell builder.
https://github.com/ca136/cli-shell-error
The text was updated successfully, but these errors were encountered: