-
Notifications
You must be signed in to change notification settings - Fork 14
Add NgModule & build FESM output using ngc & rollup #12
Conversation
base folder structure on https://github.com/jasonaden/simple-ui-lib add an NgModule build FESM output using ngc & rollup remove package.main and have package.module point to FESM
@tomwayson, I agree that what is considered best practice for structuring Angular libraries is still a bit in flux. One thing to note is that at ng-conf a few weeks back it was said that the Angular team would soon be coming out with a specification for the recommended structure of a library. However, they did not mention a date so "soon" is a relative term here. Regarding using this in a pre-v4 version of Angular it does appear that there is an issue. When running it the following error is thrown in the browser:
I'm a bit surprised by this as I'm not aware of any breaking changes around NgModule between v2 and v4. It is possible there the issue lies in a breaking change with the One note though. You have put |
Thanks @kgs916
Isn't that this document? That appears to be what is informing the repos I used as inspiration for the changes in this PR.
Hm.. could be breaking change, or maybe I did something wrong. I'm fine w/ releasing a major version that is 4.0+.
Yeah, I keep going back and forth on this. This time I was doing what the example repos recommended for for the angular libraries themselves, All in all, I don't feel comfortable taking the lead on this since I don't use Angular day to day. If someone who does feels like they've found a pattern that works, I'm glad to accept further commits to this PR or a new PR. |
@tomwayson, thanks for pointing me to where the Angular library spec is! I guess I missed its actual release. I'm happy to contribute to the PR and/or take a lead on this issue. It may take me a few days to get on it though. I'll keep you posted. |
Thanks @kgs916! No rush. |
@tomwayson I'm starting to put together some changes to this PR. I haven't contributed to an active PR before so we will see how this goes. Looks like since I have already brought down the PR locally I can just create a new commit, push, and that is it 🤞. Some of the changes that I'm planning to make are:
Let me know if you have any thoughts. |
@TheKeithStewart great!
Ordinarily, yes, but b/c this PR has conflicts, and b/c those conflicts are in package.json and related to "update esri-loader to latest" it's best to first resolve the conflicts. I'll do that, then you can pull this branch again, and you should be good to go w/ the rsync change. Thanks! |
Well, this has turned into a real cluster. I've resolved the merge conflicts, but I'm not able to get this to run locally. I'm not sure how my local tests were working before tbh, w/ the way that this is set up to publish from the dist dir. I'm not sure how to npm link from dist to the test apps. It's late, I'm tired. I've pushed my changes in case you have any insights @TheKeithStewart. |
The issue is with the copy npm script. There are a number of files from the build folder that are not getting copied into dist. Updating the copy script to this should do the trick:
I tried to make this myself and push the change to this PR but can't seem to figure out how to make it work. I have made this change locally though and tested it out successfully. Regarding the issue with |
Thx! I'll give this a try later. |
First, I was able to I then made the change you suggested to the
More of the perpetual Angular growing pains. So maybe that's the problem, or maybe I didn't get things set up right. I'm unwilling to publish any changes until I see it working in Before I said "If someone who does feels like they've found a pattern that works, I'm glad to accept further commits to this PR or a new PR." However, I'm realizing that I can't even do that. I just don't have the bandwidth to do all the trial and error to figure out what's going on. I'm sorry. |
@TheKeithStewart FYI - I see the same error after running |
@tomwayson I still can't seem to figure out how to contribute directly to this PR. What I tried this time was to push a change to the I think that the issue we are experiencing has to do with a difference between Mac and Windows and how each OS interprets the string arguments in the
This works fine on my Windows machine and I believe that the double quotes around the glob path is supposed to do the trick on a Mac. Also, I was having trouble with the exclusion argument so I went to more of an inclusion pattern. |
My apologies, I thought for sure I had added you as a collaborator earlier, but that was the other repo. You have permission now if you don't mind trying again. |
No problem, @tomwayson. That worked this time. I have pushed a new commit. |
@TheKeithStewart - you rock 🎸 🎵 🔈! This works, Was there anything left to do on this or can we |
Awesome!!! I think we are good to go. Time to 🎉🎉🎉🎉! |
Merged. Will release as part of whatever is decided for #15. |
This works npm linked in my local copy of esri-angular-cli-example (master) and in a clean angular-cli app following these instructions.
A few things I noticed when going through this though.
https://github.com/jasonaden/simple-ui-lib and https://github.com/filipesilva/angular-quickstart-lib/blob/master/build.js are actually a bit different. That I've done here is closer to the former, the latter adds minification and UMD. All in all it feels like this stuff is still evolving, and I have ZERO interest in being in that position again.
To use the config from the above, I ended up updating to angular 4. Don't know if it would work w/ 2. Feels like bumping to 4 would require a major version bump of this library. And if we're going to do that... feels like a good time to deal w/ the naming problem that the good folks at angular have left us with (i.e. rename to "angular-esri-loader"). That's a whole other level that I'm not sure I want to get involved w/ right now.
One idea, try rolling this PR back to angular2 libs and see if it works. If so release as a minor bump.
Another idea, wait until https://github.com/filipesilva/angular-quickstart-lib matures, and just fork that, rename as angular-esri-loader, copy over service and module from this, and release as v1.0.0.