title: Could not find a declaration file for module (x) implicitly has 'any' type, when importing npm package
body: <p>I've created a Typescript, React project that makes use of Storybook.js, that contains all of my components, styling and images for the project I'm working on.
  I package this project with the help of Webpack and then via an Azure pipeline I build and publish it to a private feed. I then install the package(npm install) with no problems on my main project, which is a Typescript, Next.js project. When I try to import the package into a page,</p>
  <pre><code>import {Footer} from '@private_feed/generic.project/dist/bundle.js'
  </code></pre>
  <p>I get the error mentioned in the title, along with:</p>
  <pre><code>./node_modules/next/dist/next-server/server/require.js
  Critical dependency: the request of a dependency is an expression
  
  ./node_modules/next/dist/next-server/server/load-components.js
  Critical dependency: the request of a dependency is an expression
  
  &gt; Build error occurred
  ReferenceError: document is not defined
  </code></pre>
  <p>I had it working before when i had no css and no images. I was compiling down my Typescript with tsc and all my styling was making use of styled-components. However, for project and team related reasons I need to be able to make use of css files and unfortunately not use styled-components.</p>
  <p>The following files belong to the project that is being packaged.</p>
  <p>package.json</p>
  <pre><code>{
    &quot;name&quot;: &quot;@private_feed/generic.project&quot;,
    &quot;version&quot;: &quot;0.1.11&quot;,
    &quot;files&quot;: [
      &quot;dist&quot;
    ],
    &quot;dependencies&quot;: {
      &quot;@testing-library/jest-dom&quot;: &quot;^4.2.4&quot;,
      &quot;@testing-library/react&quot;: &quot;^9.5.0&quot;,
      &quot;@testing-library/user-event&quot;: &quot;^7.2.1&quot;,
      &quot;@types/jest&quot;: &quot;^24.9.1&quot;,
      &quot;@types/node&quot;: &quot;^12.12.47&quot;,
      &quot;@types/react&quot;: &quot;^16.9.41&quot;,
      &quot;@types/react-dom&quot;: &quot;^16.9.8&quot;,
      &quot;@types/styled-components&quot;: &quot;^5.1.0&quot;,
      &quot;cross-env&quot;: &quot;^7.0.2&quot;,
      &quot;lodash&quot;: &quot;^4.17.15&quot;,
      &quot;react&quot;: &quot;^16.13.1&quot;,
      &quot;react-dom&quot;: &quot;^16.13.1&quot;,
      &quot;react-scripts&quot;: &quot;3.4.1&quot;,
      &quot;styled-components&quot;: &quot;^5.1.1&quot;
    },
    &quot;scripts&quot;: {
      &quot;start&quot;: &quot;react-scripts start&quot;,
      &quot;test&quot;: &quot;react-scripts test&quot;,
      &quot;eject&quot;: &quot;react-scripts eject&quot;,
      &quot;storybook&quot;: &quot;start-storybook -p 9009 -s public&quot;,
      &quot;build-storybook&quot;: &quot;build-storybook -s public&quot;,
      &quot;build&quot;: &quot;webpack&quot;
    },
    &quot;eslintConfig&quot;: {
      &quot;extends&quot;: &quot;react-app&quot;
    },
    &quot;browserslist&quot;: {
      &quot;production&quot;: [
        &quot;&gt;0.2%&quot;,
        &quot;not dead&quot;,
        &quot;not op_mini all&quot;
      ],
      &quot;development&quot;: [
        &quot;last 1 chrome version&quot;,
        &quot;last 1 firefox version&quot;,
        &quot;last 1 safari version&quot;
      ]
    },
    &quot;devDependencies&quot;: {
      &quot;@storybook/addon-actions&quot;: &quot;^5.3.19&quot;,
      &quot;@storybook/addon-knobs&quot;: &quot;^5.3.19&quot;,
      &quot;@storybook/addon-links&quot;: &quot;^5.3.19&quot;,
      &quot;@storybook/addons&quot;: &quot;^5.3.19&quot;,
      &quot;@storybook/preset-create-react-app&quot;: &quot;^3.1.2&quot;,
      &quot;@storybook/react&quot;: &quot;^5.3.19&quot;,
      &quot;@types/lodash&quot;: &quot;^4.14.157&quot;,
      &quot;css-loader&quot;: &quot;^3.6.0&quot;,
      &quot;file-loader&quot;: &quot;^6.0.0&quot;,
      &quot;style-loader&quot;: &quot;^1.2.1&quot;,
      &quot;ts-loader&quot;: &quot;^7.0.5&quot;,
      &quot;typescript&quot;: &quot;^3.9.6&quot;,
      &quot;webpack&quot;: &quot;^4.43.0&quot;,
      &quot;webpack-cli&quot;: &quot;^3.3.12&quot;
    },
    &quot;babel&quot;: {
      &quot;presets&quot;: [
        &quot;react-app&quot;
      ]
    },
    &quot;description&quot;: &quot;This project was bootstrapped with [Create React App].&quot;,
    &quot;author&quot;: &quot;&quot;,
    &quot;license&quot;: &quot;ISC&quot;
  }
  
  </code></pre>
  <p>webpack.config.js</p>
  <pre><code>const path = require('path');
  
  module.exports = {
      entry: './src/index.ts',
      devtool: 'inline-source-map',
      module: {
          rules: [
              {
                  test: /\.css$/,
                  use: [
                      'style-loader',
                      'css-loader'
                  ]
              },
              {
                  test: /\.(png|svg|jpg)$/,
                  use: [
                      'file-loader',
                  ],
              },
              {
                  test: /\.tsx?$/,
                  use: 'ts-loader',
                  exclude: /node_modules/,
              },
          ]
      },
      resolve: {
          extensions: [ '.tsx', '.ts', '.js' ],
      },
      output: {
          filename: 'bundle.js',
          path: path.resolve(__dirname, 'dist'),
      },
  };
  </code></pre>
  <p>tsconfig.json</p>
  <pre><code>{
    &quot;compilerOptions&quot;: {
      &quot;outDir&quot;: &quot;dist&quot;,
      &quot;target&quot;: &quot;es5&quot;,
      &quot;lib&quot;: [
        &quot;dom&quot;,
        &quot;dom.iterable&quot;,
        &quot;es2015&quot;
      ],
      &quot;allowJs&quot;: true,
      &quot;skipLibCheck&quot;: true,
      &quot;esModuleInterop&quot;: true,
      &quot;allowSyntheticDefaultImports&quot;: true,
      &quot;strict&quot;: true,
      &quot;forceConsistentCasingInFileNames&quot;: true,
      &quot;module&quot;: &quot;commonjs&quot;,
      &quot;moduleResolution&quot;: &quot;node&quot;,
      &quot;resolveJsonModule&quot;: true,
      &quot;isolatedModules&quot;: true,
      &quot;noEmit&quot;: false,
      &quot;jsx&quot;: &quot;react&quot;,
      &quot;noImplicitAny&quot;: true,
      &quot;sourceMap&quot;: true,
      &quot;typeRoots&quot;: [&quot;./src/@types&quot;, &quot;./node_modules/@types&quot;]
    },
    &quot;include&quot;: [
      &quot;src&quot;, &quot;types&quot;
    ]
  }
  </code></pre>
  <p>src/@types/assets/index.d.ts</p>
  <pre><code>declare module &quot;\*.svg&quot; {
      import React = require(&quot;react&quot;);
      export const ReactComponent: React.SFC&lt;React.SVGProps&lt;SVGSVGElement&gt;&gt;;
      const src: string;
      export default src;
    }
  
    declare module &quot;\*.css&quot; {
      const content: string;
      export default content;
    }
  </code></pre>