stephencookdev / speed-measure-webpack-plugin

⏱ See how fast (or not) your plugins and loaders are, so you can optimise your builds
MIT License
2.41k stars 80 forks source link

Types of property 'entry' are incompatible. #202

Open mrdulin opened 3 months ago

mrdulin commented 3 months ago

webpack.config.ts:

import path from 'path';
import webpack from 'webpack';
import SpeedMeasurePlugin from 'speed-measure-webpack-plugin';

const config: webpack.Configuration = {
    mode: 'production',
    entry: './src/index.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        clean: true,
    },
};

const smp = new SpeedMeasurePlugin();

export default smp.wrap(config); // TSC throws error

TSC throw errors:

Argument of type 'import("d:/workspace/mrdulin/webpack-samples/webpack-v5/examples/speed-measure-webpack-plugin-type-issue/node_modules/webpack/types").Configuration' is not assignable to parameter of type 'import("d:/workspace/mrdulin/webpack-samples/webpack-v5/examples/speed-measure-webpack-plugin-type-issue/node_modules/@types/speed-measure-webpack-plugin/node_modules/@types/webpack/index").Configuration'.
  Types of property 'entry' are incompatible.
    Type 'string | (() => string | EntryObject | string[] | Promise<EntryStatic>) | EntryObject | string[] | undefined' is not assignable to type 'string | string[] | Entry | EntryFunc | undefined'.
      Type '() => string | EntryObject | string[] | Promise<EntryStatic>' is not assignable to type 'string | string[] | Entry | EntryFunc | undefined'.
        Type '() => string | EntryObject | string[] | Promise<EntryStatic>' is not assignable to type 'EntryFunc'.
          Type 'string | EntryObject | string[] | Promise<EntryStatic>' is not assignable to type 'string | string[] | Entry | Promise<string | string[] | Entry>'.
            Type 'EntryObject' is not assignable to type 'string | string[] | Entry | Promise<string | string[] | Entry>'.
              Type 'EntryObject' is missing the following properties from type 'string[]': length, pop, push, concat, and 29 more.

package.json:

{
  "version": "1.0.0",
  "scripts": {
    "build": "webpack"
  },
  "devDependencies": {
    "@types/node": "^20.14.5",
    "@types/speed-measure-webpack-plugin": "^1.3.6",
    "@types/webpack": "^5.28.5",
    "speed-measure-webpack-plugin": "^1.5.0",
    "ts-node": "^10.9.2",
    "typescript": "^5.4.5",
    "webpack": "^5.80.0",
    "webpack-cli": "^5.0.2"
  }
}