Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

gatsby-plugin-directory-named-index

A gatsby plugin wrapping directory-named-webpack-plugin

allowing you to have the following file structure:

src/components/MyComp/MyComp.js

and yet import your files like:

import MyComp from '../src/components/MyComp'

making editor tab management and clarity simple without cluttering your file tree with unnecessary stuff.

Install

npm install --save gatsby-plugin-directory-named-index

or

yarn add gatsby-plugin-directory-named-index

Use

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-directory-named-index`,
      options: {
        // see https://github.com/shaketbaby/directory-named-webpack-plugin
        // for a full list of config options
        honorIndex: true
      },
    },
  ],
}

License

MIT

© 2023 Gatsby, Inc.