Skip to content
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

Packaging issue when using Moment.js in Library #235

Closed
plambhsa opened this issue Oct 31, 2017 · 3 comments
Closed

Packaging issue when using Moment.js in Library #235

plambhsa opened this issue Oct 31, 2017 · 3 comments

Comments

@plambhsa
Copy link

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

When running ng-packagr and trying to include moment, I get the following error:

BUILD ERROR
Cannot call a namespace ('moment')
Error: Cannot call a namespace ('moment')

How To Reproduce

Create a component/pipe that needs moment, and import it. In a normal Angular app, you would use it by doing this: import * as moment from 'moment';, but that doesn't fly when packaging the library. I changed the tsconfig.json to allowSyntheticDefaultImports but the same error occurs.

Expected Behaviour

The package should be packaged up just fine with ng-packagr, including if it has moment included.

Version Information

ng-packagr: v1.5.0-rc.1
node: v8.4.0
@angular: v4.4.6
rxjs: 5.5.2
zone.js: 0.8.18

The moment library I'm using is 2.19.1. I also tried using moment-es6 at version 1.0.0.

@KyleBastien
Copy link
Contributor

@plambhsa Try taking a look at this two issues, and see if they resolve your problem:
#163
#217

@dherges
Copy link
Contributor

dherges commented Nov 3, 2017

Hi @plambhsa, yes, can you please check the other issues if they solve your situation? Should there still be issues/questions, please comment and re-open!

@dherges dherges closed this as completed Nov 3, 2017
@github-actions
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

This action has been performed automatically by a bot.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants