Skip to content

Is devServer.static.directory works? #30

@krutoo

Description

@krutoo

Hi, I'm trying to build two bundles for server and for client by exporting array of objects from Rspack config file

Both bundles has index in entry, also:

  • Server code output path is dist/server
  • Client code output path is dist/client

My devServer config looks like:

{
  devServer: {
    hot: false,
    proxy: [
      {
        context: ['/api'],
        target: 'http://localhost:1234',
        pathRewrite: {
          '^/api': '',
        },
      },
    ],
    devMiddleware: {
      writeToDisk: true,
    },
    static: {
      directory: path.resolve(import.meta.dirname, 'dist/client'),
    },
  }
}

But when I running npx rspack serve it serves both of client and server bundles.

As a result http://localhost:8080/index.mjs returns server bundle instead client bundle

Is devServer.static.directory works? How can i serve only dist/client instead of dist?

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