← All tasks
javascriptwebpack/webpack-dev-server #4467Not a task: already works

`express-serve-static-core` and `serve-static` should be an explicit (optional) dependencies if their types are part of export

envgap__webpack__webpack-dev-server-4467

01 / FAILURE SIGNATURE

As reported upstream

.yarn/__virtual__/webpack-dev-server-virtual-ca9edd4c98/2/.yarn/berry/cache/webpack-dev-server-npm-4.9.0-35850a5f47-8.zip/node_modules/webpack-dev-server/types/lib/Server.d.ts:3197:18 - error TS2307: Cannot find module 'express-serve-static-core' or its corresponding type declarations.
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
07aaa4533b5d504db7e170cc3fa9e63cf115dc68
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

webpack/webpack-dev-server #4467 · read the original issue
<!-- Please don't delete this template otherwise your issue will be closed immediately -->

<!-- Before creating an issue please make sure you are using the latest version of webpack. -->



### Bug report



<!-- Please ask questions on discussions, StackOverflow or the webpack Gitter. -->

<!-- https://github.com/webpack/webpack/discussions -->

<!-- https://stackoverflow.com/questions/ask?tags=webpack -->

<!-- https://gitter.im/webpack/webpack -->

<!-- Issues which contain questions or support requests will be closed. -->



### Actual Behavior



<!-- Explain exactly how it behaves -->

With Webpack-dev-server@4.9.0, typescript@4.7.2, and yarn@3.2.1



```sh

$ yarn tsc



.yarn/__virtual__/webpack-dev-server-virtual-ca9edd4c98/2/.yarn/berry/cache/webpack-dev-server-npm-4.9.0-35850a5f47-8.zip/node_modules/webpack-dev-server/types/lib/Server.d.ts:3197:18 - error TS2307: Cannot find module 'express-serve-static-core' or its corresponding type declarations.



3197           import("express-serve-static-core").ParamsDictionary,

                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~



.yarn/__virtual__/webpack-dev-server-virtual-ca9edd4c98/2/.yarn/berry/cache/webpack-dev-server-npm-4.9.0-35850a5f47-8.zip/node_modules/webpack-dev-server/types/lib/Server.d.ts:3428:18 - error TS2307: Cannot find module 'express-serve-static-core' or its corresponding type declarations.



3428           import("express-serve-static-core").ParamsDictionary,

                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~



.yarn/__virtual__/webpack-dev-server-virtual-ca9edd4c98/2/.yarn/berry/cache/webpack-dev-server-npm-4.9.0-35850a5f47-8.zip/node_modules/webpack-dev-server/types/lib/Server.d.ts:3523:34 - error TS2307: Cannot find module 'serve-static' or its corresponding type declarations.



3523 type ServeStaticOptions = import("serve-static").ServeStaticOptions;

                                      ~~~~~~~~~~~~~~



.yarn/__virtual__/webpack-dev-server-virtual-ca9edd4c98/2/.yarn/berry/cache/webpack-dev-server-npm-4.9.0-35850a5f47-8.zip/node_modules/webpack-dev-server/types/lib/Server.d.ts:3556:14 - error TS2307: Cannot find module 'serve-static' or its corresponding type declarations.



3556     | import("serve-static").ServeStaticOptions<import("http").ServerResponse>

                  ~~~~~~~~~~~~~~



[9:29:45 AM] Found 4 errors. Watching for file changes.

```



### Expected Behavior



<!-- "It should work" is not a helpful explanation -->

<!-- Explain exactly how it should behave -->



tsc should compile without error. `@types/express-serve-static-core` and `@types/serve-static` should be an explicit (optional) dependencies if their types are part of export.



### How Do We Reproduce?



I'll try and create a repro repo later today.



<!-- A great way to do this is to provide your configuration via a GitHub repository -->

<!-- The most helpful is a minimal reproduction with instructions on how to reproduce -->

<!-- Repositories with too many files or large `webpack.config.js` files are not suitable -->

<!-- Please only add small code snippets directly into this issue -->

<!-- https://gist.github.com is a good place for longer code snippets -->

<!-- If your issue is caused by a plugin or loader, please create an issue on the loader/plugin repository instead -->



### Please paste the results of `npx webpack-cli info` here, and mention other relevant information

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]