shaketbaby/directory-named-webpack-plugin

typescript: cannot find module or its corresponding type declarations

bujarinnovationnorway opened this issue · 0 comments

Typescript complains about not finding module when i try to import a component into my storie.
I have storybook with typescript. In main.js under module.exports i have this:

webpackFinal: async (config) => {
    config.resolve.plugins = [
      ...(config.resolve.plugins || []),
      new DirectoryNamedWebpackPlugin({
        exclude: /node_modules/,
        extensions: config.resolve.extensions
      }),
      new TsconfigPathsPlugin({
        extensions: config.resolve.extensions,
      }),
    ];
    return {
      ...config,
      resolve: {
        ...config.resolve,
        alias: {
          ...config.resolve.alias,
          "@components": path.resolve(__dirname, "../", "src/components"),
          "@emotion/core": path.resolve("node_modules/@emotion/react"),
          "emotion-theming": path.resolve("node_modules/@emotion/react"),
        },
      },
    };

and in tsconfig i have this:

   "baseUrl": "./",
    "paths": {
      "@components/*": ["src/components/*"],
    },