Skip to content

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

Closed
@wegry

Description

@wegry

Bug report

Actual Behavior

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

$ 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

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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions