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

How to add a new npm module to the plugin #34

Open
Lekha30 opened this issue Mar 14, 2023 · 1 comment
Open

How to add a new npm module to the plugin #34

Lekha30 opened this issue Mar 14, 2023 · 1 comment

Comments

@Lekha30
Copy link

Lekha30 commented Mar 14, 2023

I have installed the plugin to seed my data. However, my data requires a uuid to be generated . I have uuid installed in my lambda layer function. But I am not sure how to make use of the npm module inside my seed-data.js file. I searched in Google to figure out an answer to this but couldn't find one, hence raising it here.

Thanks.

@LaurensBrinker
Copy link
Contributor

LaurensBrinker commented Mar 14, 2023

If the UUID package is installed in your project, you should be able to use it in the seed-data.js file. How are you using it currently? IIRC, you have to us CommonJS to import - you have to use something like const uuid = require('uuid'); (you can't use "import ... ".

And then you can do: console.log('Here is a test v4 uuid: ${uuid.v4()}');

Note: if you're using this for generating IDs, you don't have to provide the ID attribute in the Seed data script. Under the hood, it will set a random UUID if you don't specify one yourself.

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

2 participants