ChristopherBiscardi / gatsby-mdx

Gatsby+MDX • Transformers, CMS UI Extensions, and Ecosystem Components for ambitious projects
https://gatsby-mdx.netlify.com/
715 stars 100 forks source link

Local (Remark) Plugin does not resolve #406

Closed leifniem closed 5 years ago

leifniem commented 5 years ago

Describe the bug I configured gatsby-config.js to include a local remark plugin and receive the following error message:

  Error: Cannot find module 'gatsby-remark-images-remove-wrapper'
  Require stack:
  - /Volumes/Files/Users/leif/dev_stuff/port/node_modules/gatsby-mdx/gatsby/extend-node-type.js
  - /Volumes/Files/Users/leif/dev_stuff/port/node_modules/gatsby-mdx/gatsby-node.js
  - /Volumes/Files/Users/leif/dev_stuff/port/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
  - /Volumes/Files/Users/leif/dev_stuff/port/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
  - /Volumes/Files/Users/leif/dev_stuff/port/node_modules/gatsby/dist/bootstrap/load-plugins/load.js
  - /Volumes/Files/Users/leif/dev_stuff/port/node_modules/gatsby/dist/bootstrap/load-plugins/index.js
  - /Volumes/Files/Users/leif/dev_stuff/port/node_modules/gatsby/dist/bootstrap/index.js
  - /Volumes/Files/Users/leif/dev_stuff/port/node_modules/gatsby/dist/commands/develop.js
  - /Volumes/Files/Users/leif/dev_stuff/port/node_modules/gatsby-cli/lib/create-cli.js
  - /Volumes/Files/Users/leif/dev_stuff/port/node_modules/gatsby-cli/lib/index.js
  - /Volumes/Files/Users/leif/dev_stuff/port/node_modules/gatsby/dist/bin/gatsby.js

Not sure if this an error on my end and i need to import the module or an issue with gatsby-mdx

To Reproduce Add local plugin to gatsbyRemarkPlugins in gatsby-config.js

Expected behavior Plugin is found gets invoked when processing mdx files

Additional Context Folder structure in local plugins folder is as follows:

plugins
└── gatsby-remark-images-remove-wrapper
    ├── index.js
    ├── node_modules
    ├── package.json
    └── yarn.lock
pedrolamas commented 5 years ago

I've had the same issue, seems that gatsby-mdx isn't picking up local plugins from the "plugins" folder...

My solution was to manually require it, as you can see here: https://github.com/PedroLamas/pedrolamas.com/blob/gatsby/gatsby-config.js#L55