You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't get local plugins to work.
I followed the documentation, but it then throws an error if I leave the plugin's package.json as an empty object {}. (See the JSON.parse error below)
When I specify a main field in the package.json, I don't get the error but my plugin seems to not be executed at all.
The documentation page just tells to create an empty package.json and a gatsby-node.js, but if you look at actual plugins in this repo, their structure is completely different. For example here, the main field is also specified and points to an empty index.js file, while the gatsby-node.js file is inside a src folder and not on the plugin's root.
This is all really confusing to me, and doing it as specified in the documentation doesn't work for me.
Environment
Gatsby version: 1.9.119
Node.js version: v8
Operating System: Windows 10
File contents (if changed):
gatsby-config.js:
plugins: [{resolve: `local-plugin`,// this does not need to be a relative path, doesn't it?options: {// Setting a color is optional.color: `tomato`,},}]
Thanks, setting it up like in your project works 👍
Not sure what I did differently, I couldn't reproduce my JSON parse error anymore, even with an empty package.json
The other times it just looked like it was not working, because I made a default export like in remark-plugins, and did not use one of the provided hooks.
Description
I can't get local plugins to work.
I followed the documentation, but it then throws an error if I leave the plugin's
package.json
as an empty object{}
. (See the JSON.parse error below)When I specify a
main
field in thepackage.json
, I don't get the error but my plugin seems to not be executed at all.The documentation page just tells to create an empty
package.json
and agatsby-node.js
, but if you look at actual plugins in this repo, their structure is completely different. For example here, themain
field is also specified and points to an emptyindex.js
file, while thegatsby-node.js
file is inside asrc
folder and not on the plugin's root.This is all really confusing to me, and doing it as specified in the documentation doesn't work for me.
Environment
Gatsby version: 1.9.119
Node.js version: v8
Operating System: Windows 10
File contents (if changed):
gatsby-config.js
:Actual result
Running
gatsby-develop
throws an error:Expected behavior
What should happen?
My plugin should be executed.
The text was updated successfully, but these errors were encountered: