npm run dev fails : ValidationError: Invalid options object

This is not an issue with webpack or webpack-dev-server itself, but with the copy-webpack-plugin plugin. With the update to the 6.x major version came a breaking change: instead of just passing the array with the config patterns directly to the CopyWebpackPlugin constructor, your now have to wrap it in the patterns property of an object … Read more

webpack dev server CORS issue

Another way to work around it is to directly add the required CORS headers to the dev server: devServer: { … headers: { “Access-Control-Allow-Origin”: “*”, “Access-Control-Allow-Methods”: “GET, POST, PUT, DELETE, PATCH, OPTIONS”, “Access-Control-Allow-Headers”: “X-Requested-With, content-type, Authorization” } } Doc links Webpack dev server Access-Control-Allow-Headers Access-Control-Allow-Methods Access-Control-Allow-Origin

Running a node express server using webpack-dev-server

Webpack-dev-server is great for client side development but it will not deploy Express api’s or middleware. So in development I recommend running two separate servers: One for the client and one for your server side api’s. Nodemon npm install –save-dev nodemon is a good backend development server that will give you hot-redeploy of your api’s, … Read more

Webpack-dev-server compiles files but does not refresh or make compiled javascript available to browser

Two things were causing my problems here: module.exports = { entry: ‘./src/index.js’, output: { // For some reason, the `__dirname` was not evaluating and `/public` was // trying to write files to a `public` folder at the root of my HD. path: __dirname + ‘/public’, // Public path refers to the location from the _browser’s_ … Read more

Webpack-dev-server serves a directory list instead of the app page

If you’re using webpack’s dev server you can pass in options to use /public as a base directory. devServer: { publicPath: “https://stackoverflow.com/”, contentBase: “./public”, hot: true }, See the webpack configuration docs, and specifically the webpack dev server docs for more options and general information.

Webpack vs webpack-dev-server vs webpack-dev-middleware vs webpack-hot-middleware vs etc

webpack As you’ve described, Webpack is a module bundler, it bundles various module formats primarily so they can be run in a browser. It offers both a CLI and Node API. webpack-dev-middleware Webpack Dev Middleware is middleware which can be mounted in an express server to serve the latest compilation of your bundle during development. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)