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

Unable to NAR when leveraging Semantic-UI or Angular2 #135

Open
steve-gray opened this issue Apr 20, 2016 · 10 comments
Open

Unable to NAR when leveraging Semantic-UI or Angular2 #135

steve-gray opened this issue Apr 20, 2016 · 10 comments

Comments

@steve-gray
Copy link

Whenever I create a NAR package that references semantic-ui or angular2 from package.json, I get errors such as:

  • Error: Cannot find module 'semantic-ui' from '/Users/steveg/Desktop/workspace/linehaul/linehaul-web'

I suspect that's something inside these two projects particularly that's tripping nar up.

@h2non
Copy link
Owner

h2non commented Apr 20, 2016

Seems like those package cannot be resolved via node.js module lookup algorithm. I would have to add some exception for those packages, or ask to the package mintainers to add a 'main' field in package.json

@steve-gray
Copy link
Author

steve-gray commented Apr 20, 2016

What if I did a script-step that went through and scanned for every package.json, and then simply checked for:

  • Missing a main-field?
  • Create a .js file in folder.
  • Set that as the main.

As a pre-step before NAR?

*Caveat: Yes, I know how crappy this is. People are using NPM to ship XML/JSON files.... *

@steve-gray
Copy link
Author

steve-gray commented Apr 20, 2016

Ugh, that seems to not work. Is there any way to basically do a 'ignore dependencies' but then also 'include all of the things' - basically a brute force ./*/.* glob? I'm getting module load errors when I try something a bit like:

nar create --omit-dependencies -i */.* -e

Update On further analysis it appears that the ignore-like files option is precluding the node_modules manually being packed in, which then leads to the interesting situation where we're now missing the ability to ignore ignore-like-files.

Is there a quick-and-dirty fix for this? I'm keen to demo NAR with our app tomorrow to someone.

@h2non
Copy link
Owner

h2non commented Apr 20, 2016

Let check it in detail and I'll give a definitive answer.

@steve-gray
Copy link
Author

steve-gray commented Apr 20, 2016

Cheers,

In the meantime I've worked around the issue by creating:

What I've done is:

  • Added the disable-ignorefiles commandline option. It's part of the API but was missing from the CLI spec.
  • Hacked out the hardcoded ignoring of node_modules.

Then when it's installed globally, you can use:

nar create -e -l -n

(Executable, disable ignorefiles, dont process dependencies)

This packs the application and works because it basically just vacuums up the whole workspace, including node_modules - it's awful, but will suffice as an interim measure whilst we await a more official solution.

@steve-gray
Copy link
Author

Is there any recommendation on a more solid fix? My hacky fork isn't particularly a wise idea.

@h2non
Copy link
Owner

h2non commented May 1, 2016

Sorry for the silence these days. One solution could be as simple as adding an resolution exception here:
https://github.com/h2non/resolve-tree/blob/master/index.js#L7-L13

That solution won't be transversal to other similar scenario, but should fix your issue.
Regarding to your fork, the CLI flag should be added to nar. Feel free to create a PR if you want.

Additionally, as feature request, I would like to consider supporting the ability to ignore certain dependency packages.

@h2non
Copy link
Owner

h2non commented May 7, 2016

semantic-ui package should be resolved in nar@0.3.37. Try it again upgraging nar.

@steve-gray
Copy link
Author

Cheers: Was there something about Angular2 that meant it couldn't get the same lovin' or have they fixed something whilst I wasn't looking?

@h2non
Copy link
Owner

h2non commented May 8, 2016

I've simply added an resolution path extension in resolve-tree package. This should fix your particular issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants