-
Notifications
You must be signed in to change notification settings - Fork 100
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 #195
Comments
Approach 1 Adding a .babelrc file in the root of your plugin folder:
Updating your plugins package.json
Then running the build: And adding to my own project tsconfig.json
But still getting the same error with Angular Universal :( |
Approach 2 So far it seems to be building, but I think i've got some of the paths wrong? I think it's very close to working! |
I needed a solution working today, so switched to this library instead which supports Angular Universal: |
Angular 7, same error: ../ngx-drag-scroll/lib/ngx-drag-scroll-item.js:1 |
I've solved this problem by converting the package to an ES2015 UMD module with babel and the transform-es2015-modules-umd like this: |
@HighSoftWare96 can you give more details about how install babel and use it with angular 5? |
Here you can find the documentation. First install Babel then the required plugins. Finally you can run that command. |
@HighSoftWare96 would you like to make a PR to improve the library? |
Yeah I would but you should add the babel script in your package process so it runs automatically each time you change something.. Where should I put that? In the package.json? |
Sorry I totally missed your comment. Yes, that would be in the package.json. |
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:
Either use my demo repo:
https://github.com/kmturley/universal-starter
OR
Duplicate the Angular Universal starter project from:
https://github.com/angular/universal-starter
Add your library, following install instructions:
https://github.com/bfwg/ngx-drag-scroll
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
The text was updated successfully, but these errors were encountered: