shaketbaby / directory-named-webpack-plugin

A Webpack plugin that treats a file with the name of directory as the index file
MIT License
182 stars 17 forks source link

Webpack 5 compatibility? #64

Open Benxter83 opened 2 months ago

Benxter83 commented 2 months ago

Hi there. I wanted to add your plugin to an existing webpack 5 (latest version: 5.93.0) powered project:

webpack.config.js

...
const DirectoryNamedWebpackPlugin = require("directory-named-webpack-plugin");
....
resolve: {
      extensions: [".js", ".jsx", ".tsx", ".ts", ".json"],
      plugins: [
        new DirectoryNamedWebpackPlugin(true),
        new TsConfigPathsPlugin({
          tsconfig: "tsconfig.build.json",
        }),
      ],
    },

but it doesn't seem to work properly.

for example I have a component in "/src/components/CustomComponent/CustomComponent.tsx" and I can only import the component with "../components/CustomComponent/CustomComponent" but not with "../components/CustomComponent" as it should work.

I am also using the following packages (all updated to the latest versions) with the project: package.json - devDependencies:

    "webpack": "^5.93.0",
    "webpack-bundle-analyzer": "^4.10.2",
    "webpack-cli": "^5.1.4",
    "webpack-dev-server": "^5.0.4"