-
Notifications
You must be signed in to change notification settings - Fork 142
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
Angular Universal build prerender error #370
Comments
I also got the same error, I have angular universal installed
|
I ended up writing my own directive which works with Universal:
import it into your Module:
and use on an image with: |
works with this added this on webpack config
|
I guess I guess we have to set up multiple targets for @xmasuku, can you give a more detail example of your webpack config? Where do you use |
@tjoskar I used my custom webpack build, I was not using angular cli |
I have generated a cli project and I get the same error |
Okay, I will try to take a look at it tonight |
I experience the same issue while trying to build with angular universal. @tjoskar have you thought about using |
// Looks like its the common issue for universal eg. angular/angular-cli#7200 // then create webpack.server.config.js add code below:
// my server.ts
|
For now, this should work. |
@tjoskar I used your branch and it seems to fix the issue with the build error. Do you have a plan when you are going to merge and release it? |
@Loutrinos, Sorry for the delay. Can you please try to install |
@tjoskar I see in the 5.1.0 release that the structure is different. This is ok for now as it's a beta release. |
Sorry about that, I created a new release ([email protected]) with the same structure as before. My previous weeks have been quite hectic but now I'm back to business so let me know how it works for you. |
After installed 5.1.1 version and I'm getting this error: |
@agustintarifa How does your I just created this repo: https://github.com/tjoskar/ng-lazyload-image-bugs/tree/master/370-universal-starter-compile and it seams to work fine. I cloned https://github.com/angular/universal-starter, installed |
Thanks for the answer @tjoskar The only problem, the offset is not working at the top to see the first image I need to scroll 1px at least and then the other one loads when are visible, I want to load the images 200px before |
Humm.. In my example above I only declare @agustintarifa, Regarding the offset problem. Can you create a new issue for that? |
Hi, when can we expect v5.1.1 as a stable not beta? Because i have this problem with SSR too. |
@vytautas-pranskunas-, I will release it tomorrow with some other smaller fixes. |
Siunds great 👍
…On Mon, Apr 1, 2019, 9:17 PM Oskar Karlsson ***@***.***> wrote:
@vytautas-pranskunas- <https://github.com/vytautas-pranskunas->, I will
release it tomorrow with some other smaller fixes.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#370 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADvMl18aKahOsS6vr4C4h4Tagwy2p4TNks5vclsrgaJpZM4Z0lGg>
.
|
|
I'm submitting a ...
Do you want to request a feature or report a bug?
Bug with your library and Angular Universal build prerender functionality
What is the current behavior?
When you run the command:
npm run build:prerender
it runs:
"generate:prerender": "cd dist && node prerender",
Then fails with the error:
Duplicate the Angular Universal starter project from:
https://github.com/angular/universal-starter
Add your library, following install instructions:
https://github.com/tjoskar/ng-lazyload-image
Run the Angular build command to see the error:
npm run build:prerender
What is the expected behavior?
No error, and to continue building.
What is the motivation / use case for changing the behavior?
Otherwise your plugin cannot be used with Angular Universal, which means no static site generation :(
Please tell us about your environment:
Other information
Looks like other people have had similar problems with Angular Universal and third-party libraries such as yours:
angular/angular-cli#7200 (comment)
They say the third-party libraries aren't being built correctly, which means Angular Universal fails:
angular/angular-cli#7200 (comment)
for example they suggest adding to your package.json
Approach 1
Patch your plugin root:
npm install @babel/cli @babel/core @babel/preset-env @babel/plugin-transform-modules-umd
Adding a .babelrc file in the root of your plugin folder:
Updating your plugins package.json
Then running the build:
npm run build:es5 && npm run build:umd
And adding to my own project tsconfig.json
But still getting the same error with Angular Universal :(
Approach 2
Use the Typescript build options for the example project at:
https://github.com/filipesilva/angular-quickstart-lib
The text was updated successfully, but these errors were encountered: