SamKirkland / plop-templates

VSCode extension for plop.js file templates
MIT License
23 stars 5 forks source link

Error when trying to use extension #8

Closed gnoesiboe closed 4 years ago

gnoesiboe commented 4 years ago

In VSCode, when I right click a folder, and choose: 'New File from Plop Template', I get the folowing error:

Couldn't load plop config file at the path: "/home/gnoesiboe/projects/freshheads-data-20/plopfile.js" - require(...) is not a function

At the exact path mentioned above, a plopfile.js resides with contents:

// /home/gnoesiboe/projects/freshheads-data-20/plopfile.js

module.exports = function (plop) {
    plop.load('@freshheads/project-tools/build/plop/plopfile.js');
};

Can you tell me why this not working? Am I overlooking something? Many thanks in advance for your answer!

SamKirkland commented 4 years ago

I don't think this is due to my or jpmartinez extension.

I haven't used plops load feature yet, but looking at their docs it appears your config should be similar to the following:

module.exports = function (plop) {
    plop.load('@freshheads/project-tools');
};

// in your "@freshheads/project-tools" npm module you should have your package.json "main" point to "/build/plop/plopfile.js"
gnoesiboe commented 4 years ago

@SamKirkland The package.json main is not pointed to /build/plop/plopfile.js, as this repository contains more then just plop stuff. But I don't think that's the problem. I removed this line and replaced with inline generators and it still didn't work.