webpack / webpack-dev-middleware

A development middleware for webpack
MIT License
2.5k stars 377 forks source link

Fix support dev server false #1921

Closed alexander-akait closed 1 month ago

alexander-akait commented 1 month ago

This PR contains a:

Motivation / Use-Case

ref https://github.com/webpack/webpack-cli/pull/4045/

Breaking Changes

No

Additional Info

When you have devServer: false in your multi comiler mode we will just watch and do not server, so you can use something like:

const path = require("path");

module.exports = [
  {
    target: "webworker",
    mode: "development",
    entry: "./workers/worker.js",
    output: {
      path: path.resolve(__dirname, `public`),
    },
    devServer: false,
  },
  {
    devtool: false,
    mode: "development",
    entry: "./entries/entry1.js",
    output: {
      path: path.resolve(__dirname, `static`),
      publicPath: "/static/"
    },
    devServer: {
      host: "localhost",
    },
  },
];

Useful when you have something what should just bundle and handle like static content - https://expressjs.com/en/starter/static-files.html

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.05%. Comparing base (fdd8801) to head (c2f040a). Report is 1 commits behind head on master.

Files Patch % Lines
src/utils/setupWriteToDisk.js 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1921 +/- ## ========================================== - Coverage 96.14% 96.05% -0.10% ========================================== Files 13 13 Lines 831 837 +6 Branches 228 233 +5 ========================================== + Hits 799 804 +5 - Misses 32 33 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.