Skip to content
This repository has been archived by the owner on Aug 2, 2018. It is now read-only.

Require local bower component? #467

Open
topherfangio opened this issue May 20, 2015 · 3 comments
Open

Require local bower component? #467

topherfangio opened this issue May 20, 2015 · 3 comments

Comments

@topherfangio
Copy link

Since Duo does not currently support private Bower/GitHub URLs, I was hoping I could still use Bower to download my dependencies, but then use Duo to bundle everything. I like how Duo scans my CSS/JS files for bower assets like images and copies them to the proper location after bundling, which I can't find anything similar in the Gulp world.

So, I'm trying to do the following in my app.js file:

require('./bower_components/my-special-component');

// My code goes down here

Unfortunately, I get the following error:

Error: bower_components/my-special-component@*: cannot resolve

Is there another/better way to do this? I was hoping it would find the bower.json file that has a main with all of my dependencies, but it looks like it's not.

Thanks! Looking forward to when Duo takes over the world ;-)

@dominicbarnes
Copy link
Contributor

I believe this issue is caused by Duo looking for an index.js in the my-special-component directory. If that component uses something other that index.js as it's entry, you'll need to specify that instead.

require('./bower_components/my-special-component/my-special-component.js');

If that doesn't work, I think I know something else that might be the problem.

@topherfangio
Copy link
Author

Ah, I see my incorrect thinking...I was thinking I needed to point to where the bower.json was so that Duo would automatically pick up the CSS file too, but that is totally wrong. I need to have a require pointing to the JS file, and an import pointing to the CSS. From there, it should be able to figure out everything else.

I'll give that a try and post back.

@dominicbarnes
Copy link
Contributor

Yeah, you need to import your JS and CSS for duo to recognize them, plus duo doesn't even consider the bower.json file.

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

No branches or pull requests

2 participants