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

import node module in js file #36

Closed
iam-robin opened this issue Oct 8, 2018 · 4 comments
Closed

import node module in js file #36

iam-robin opened this issue Oct 8, 2018 · 4 comments
Assignees

Comments

@iam-robin
Copy link

Hi, thanks for your awesome module!

I've installed the node module with npm install rgbaster and now want to import the node module in one of my js files. But there is not just a single function I can reference.

Here is my Code:

import rgbaster from './rgbaster';

RGBaster.colors(img, {
  success: function(payload) {
    // You now have the payload.
    console.log(payload.dominant);
    console.log(payload.secondary);
    console.log(payload.palette);
  }
});

Thanks for the help!

@briangonzalez briangonzalez self-assigned this Oct 8, 2018
@briangonzalez
Copy link
Owner

@iam-robin You're welcome. What is your question exactly so I can better assist?

@iam-robin
Copy link
Author

I wanna use rgbaster in a chrome extension project. Therefore I wanna import rgbaster in one of my js files. I already installed the node module but don't know how to import it into my js file.

I've tried
import rgbaster from './rgbaster';
But it didn't work

@eltonmesquita
Copy link
Contributor

Hello @iam-robin .
When working with a bundler like webpack, parcel or rollup, use 'rgbaster' like this:

    import rgbaster from 'rgbaster';

Period and slash ./ works for local modules.

@briangonzalez
Copy link
Owner

Oh, nice catch @eltonmesquita!

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

No branches or pull requests

3 participants