Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0.0-rc.1 is incompatible with Fastify #602

Closed
artembatura opened this issue Mar 19, 2020 · 10 comments
Closed

4.0.0-rc.1 is incompatible with Fastify #602

artembatura opened this issue Mar 19, 2020 · 10 comments

Comments

@artembatura
Copy link

  • Node Version: v13.11.0
  • NPM Version: 6.13.7
  • webpack Version: 4.42.0
  • webpack-dev-middleware Version: 4.0.0-rc.1

Actual Behavior

When I trying to access application from browser, build is failing with error TypeError: res.get is not a function. In previous version, 3.7.2 it's not happened

I checked that error is happening in new version on this code line

Code

const webpack = require('webpack');
const middleware = require('webpack-dev-middleware').default;
const path = require('path');
const compiler = webpack({
  entry: './src/index.js',
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist'),
  },
});
const fastify = require('fastify');
const app = fastify();

app.use(
  middleware(compiler)
);

app.listen(3000, () => console.log('Example app listening on port 3000!'));

How Do We Reproduce?

  1. Bootstrap project from scratch with npm init
  2. Run npm i webpack webpack-dev-middleware@next fastify
  3. Create file src/index.js and write something valid
  4. Place the code above to ./run-webpack.js
  5. Run node run-webpack.js
  6. Try to access http://localhost:3000/main.js in your browser

Notes

  • I also checked that my example works with Express normally, but with Fastify not
artembatura added a commit to artembatura/zero-scriptsjs that referenced this issue Mar 19, 2020
(plugin-webpack-spa) Revert back webpack-dev-middleware to 3.7.2. Fixes build crash on access to app in development mode (webpack/webpack-dev-middleware#602) and removes extra logs to console
(plugin-webpack-babel) Fix extra size of bundle in production mode, reduced ~44kb on the React example app
(plugin-webpack-spa) Plugins clean-webpack-plugin and copy-webpack-plugin now is used only in production mode
(plugin-webpack-spa) Remove script-ext-html-webpack-plugin
artembatura added a commit to artembatura/zero-scriptsjs that referenced this issue Mar 19, 2020
(plugin-webpack-spa) Revert back webpack-dev-middleware to 3.7.2. Fixes build crash on access to app in development mode (webpack/webpack-dev-middleware#602) and removes extra logs to console
(plugin-webpack-babel) Fix extra size of bundle in production mode, reduced ~44kb on the React example app
(plugin-webpack-spa) Plugins clean-webpack-plugin and copy-webpack-plugin now is used only in production mode
(plugin-webpack-spa) Remove script-ext-html-webpack-plugin
artembatura added a commit to artembatura/zero-scriptsjs that referenced this issue Mar 19, 2020
(plugin-webpack-spa) Revert back webpack-dev-middleware to 3.7.2. Fixes build crash on access to app in development mode (webpack/webpack-dev-middleware#602) and removes extra logs to console
(plugin-webpack-babel) Fix extra size of bundle in production mode, reduced ~44kb on the React example app
(plugin-webpack-spa) Plugins clean-webpack-plugin and copy-webpack-plugin now is used only in production mode
(plugin-webpack-spa) Remove script-ext-html-webpack-plugin
artembatura added a commit to artembatura/zero-scriptsjs that referenced this issue Mar 19, 2020
(plugin-webpack-spa) Revert back webpack-dev-middleware to 3.7.2. Fixes build crash on access to app in development mode (webpack/webpack-dev-middleware#602) and removes extra logs to console
(plugin-webpack-babel) Fix extra size of bundle in production mode, reduced ~44kb on the React example app
(plugin-webpack-spa) Plugins clean-webpack-plugin and copy-webpack-plugin now is used only in production mode
(plugin-webpack-spa) Remove script-ext-html-webpack-plugin
artembatura added a commit to artembatura/zero-scriptsjs that referenced this issue Mar 19, 2020
(plugin-webpack-spa) Revert back webpack-dev-middleware to 3.7.2. Fixes build crash on access to app in development mode (webpack/webpack-dev-middleware#602) and removes extra logs to console
(plugin-webpack-babel) Fix extra size of bundle in production mode, reduced ~44kb on the React example app
(plugin-webpack-spa) Plugins clean-webpack-plugin and copy-webpack-plugin now is used only in production mode
(plugin-webpack-spa) Remove script-ext-html-webpack-plugin
artembatura added a commit to artembatura/zero-scriptsjs that referenced this issue Mar 19, 2020
(plugin-webpack-spa) Revert back webpack-dev-middleware to 3.7.2. Fixes build crash on access to app in development mode (webpack/webpack-dev-middleware#602) and removes extra logs to console
(plugin-webpack-babel) Fix extra size of bundle in production mode, reduced ~44kb on the React example app
(plugin-webpack-spa) Plugins clean-webpack-plugin and copy-webpack-plugin now is used only in production mode
(plugin-webpack-spa) Remove script-ext-html-webpack-plugin
@alexander-akait
Copy link
Member

alexander-akait commented Mar 20, 2020

We never will be compatibility with fastify, we support only express officialy

In previous version, 3.7.2 it's not happened

it was just luck

artembatura added a commit to artembatura/zero-scriptsjs that referenced this issue Mar 22, 2020
…570)

(plugin-webpack-spa) Revert back webpack-dev-middleware to 3.7.2. Fixes build crash on access to app in development mode (webpack/webpack-dev-middleware#602) and removes extra logs to console
(plugin-webpack-babel) Fix extra size of bundle in production mode, reduced ~44kb on the React example app
(plugin-webpack-spa) Plugins clean-webpack-plugin and copy-webpack-plugin now is used only in production mode
(plugin-webpack-spa) Remove script-ext-html-webpack-plugin
@artembatura
Copy link
Author

Supporting availability to use with two frameworks is bad idea, agreed

@alexander-akait
Copy link
Member

In theory we can implement it, but we need improve tests, let's mark it is feature

@pearofducks
Copy link
Contributor

@artemirq (and any others who find this) - this is working fine with the lastest fastify and fastify-express as the middleware provider (instead of middie)

@alexander-akait
Copy link
Member

@pearofducks yep, can you send a PR to docs how to use it with fastify?

@WraithKenny
Copy link

This is also breaking with browser-sync where before it was working fine. (In my setup, I have a Gulp file which runs a BrowserSync server, which loads the middleware.) It's the same issue here; should I make a new issue, or just leave this note?

@alexander-akait
Copy link
Member

we never supports faslity, please look at README, we write how you should use it with fastify

@gpoitch
Copy link
Member

gpoitch commented Oct 29, 2020

4.0 breaks compatibility with vanilla node http too. (res.get vs res.getHeader)

@alexander-akait
Copy link
Member

PR exists #747, we never support is too, I think we fix it in near patch release

@alexander-akait
Copy link
Member

Close in favor #945, hope we will improve this in near future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@WraithKenny @gpoitch @pearofducks @alexander-akait @artembatura and others