-
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
Universal server bundle is not working properly #7200
Comments
Same error using |
@FrozenPandaz @alxhub any idea what the problem is? |
Is the server bundle allowing all formats (umd, es2015, commonjs and so on) ? Because I noticed flex-layout doesn't have all the package.json entry points compared to other official Angular package, and node requires commonjs compatible librairies. |
@chrillewoodz I´ve cloned and wanted to have a look in your repo, nevertheless I don´t found the script universal in the package.json neither following the steps of the https://github.com/angular/angular-cli/wiki/stories-universal-rendering Can it be part of the problem? |
@chrillewoodz it doesn't look like you have followed the wiki step by step, @ampgular is correct with what he's pointed out, but also your @angular/cli version should be the RC release in your package.json. You have:
When you should have:
You should also update your global |
It looks like I didn't push the latest stuff, my bad. Anyway I know others who have gotten the same issue so it's not an issue with my setup. But I will make sure to push it once I get the opportunity. |
There, I've pushed the latest changes. Now you should be able to find a |
If it can help, I did a blog post with full explanations. First it will help you about the hash (no need of it), and second the first thing I would consider is to stick to node. ts-node is a great tool, but in this case it adds more complexity to an already complex configuration, you can do the same with just node. |
@cyrilletuzi Have you actually tested it out with |
Just tried, I get the same error (the first one). So you know, there was the exact same error with One point which surprised me first is that the server bundle only contains the app code. So Angular packages ( Shouldn't the CLI produce a vendor bundle too, to be sure everything is here in the good format ? |
By the way, having to install Angular packages on the server is OK in Node, but it will be impossible with other languages Universal engines (like the one for .NET). |
I'm seeing the same with |
I've noticed the same problem with ngx-translate: ngx-translate/core#616 |
We are working on a fix with the libraries themselves. In the meantime, you can use (this is not a supported solution, just a fix) something like https://www.npmjs.com/package/import-export. Alternatively, you can disable AOT in the meantime. I'm keeping this issue open in the meantime for keeping the discussion. |
Sounds great :) Any early estimate on when this could be resolved? Just so I can plan ahead a bit. |
What's the proposed fix for each of the libraries? I'm guessing to export a variety of formats like Just now I saw a PR to change the format of angulartics2 to CommonJS which I'm guessing is a wrong fix |
Even when I do my build with the '--no-aot' flag, I still get the same error.
Has anyone else managed to work around this problem? I'd appreciate any help as this is currently completely blocking my plans to go live with my changes. |
I am also experiencing this issue but for ngx-meta (https://github.com/ngx-meta/core) |
I cannot use bundleDependencies=all as it is throwing an error like this What are the requirements for a module to be Universal compatible? |
Same error using @ngx-google-places-autocomplete import { Directive, ElementRef, EventEmitter, Input, NgZone, Output } from '@angular/core'; can anyone help me to resolve this??? |
Same error using @edcarroll/ng2-semantic-ui universal-starter/node_modules/ng2-semantic-ui/dist/modules/dropdown/directives/dropdown-menu.js:11 import { Directive, ContentChild, forwardRef, Renderer2, ElementRef, ContentChildren, QueryList, Input, HostListener, ChangeDetectorRef } from "@angular/core"; Someone fixed with such a problem? |
Up, still doesn't work on Angular 7. Trying with Firebase Cloud Functions to render on server.
Currently you have to set up custom webpack and whitelist these problematic modules, like so: webpack custom
A good example is here. |
Hi all, this issue should be solved in version 8, and in version 9 bundleDependencies will be turned on by default. The new 8.x versions of You can also use the next version for Ivy and version 9 by using 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
)Versions.
@angular/cli: 1.3.0-rc.1
node: 6.10.3
os: darwin x64
Repro steps.
Follow these steps here:
https://github.com/angular/angular-cli/wiki/stories-universal-rendering
Add https://github.com/ngx-translate/core to the app.
Build a server bundle.
Test it and you will see the error below.
The log given by the failure.
Desired functionality.
Basically the issue here is that node is resolving the wrong module. It's looking inside of the
node_modules
folder instead of in thevendor
file in the server bundle.Mention any other details that might be useful.
You can download a project with these steps already done:
https://github.com/chrillewoodz/ng-boilerplate/tree/universal
So simply run
npm run universal
and you will see the error.The text was updated successfully, but these errors were encountered: