How to watch index.html using webpack-dev-server and html-webpack-plugin

The problem is that index.html is not being watched by Webpack. It only watches those files that are “required” or “imported” somewhere in your code and the loaders are testing for. The solution has two parts. First require the index.html file in your entry point. Technically, you can require it anywhere in your application, but … Read more

How to use VS Code debugger with webpack-dev-server (breakpoints ignored)

From my experience (about 15 mins ago), if ‘webpack.config.js’ has a value for the context property, then that has to be accounted for for ‘.vscode/launch.json’. For an example, if ‘webpack.config.js’ has the following: module.exports = { context: path.resolve(__dirname, ‘src’), entry: ‘./index.ts’, Then launch.json needs that context (‘src’) too: “url”: “http://localhost:8080/”, “webRoot”: “${workspaceRoot}/src”, “sourceMaps”: true, I … Read more

How to pass .env file variables to webpack config?

You can use dotenv package for this purpose. npm install dotenv –save After installing the package, add this in the top of your config: const webpack = require(‘webpack’); // only add this if you don’t have yet // replace accordingly ‘./.env’ with the path of your .env file require(‘dotenv’).config({ path: ‘./.env’ }); then in plugins … Read more

How to serve an Angular 2 dist folder index.html

You can use http-server for doing so. First of all generate a build using the command ng build –prod –aot –output-hashing=none. This will create a dist folder in your directory structure. After this, run http-server ./dist, which will start serving your project from dist folder. Make sure you have installed http-server globally using npm install … Read more

Vue cli 3 hot reload suddenly not working in browsers

My problem was WDS Console displayed: [HMR] Waiting for update signal from WDS… [WDS] Disconnected! GET http://ip:port/sockjs-node/info?t=some-number net::ERR_CONNECTION_TIMED_OUT sockjs.js?some-number Solution for me was: in package.json change “serve”: “vue-cli-service serve”, to “serve”: “vue-cli-service serve –host localhost”, or add module.exports = { devServer: { host: ‘localhost’ } } to vue.config.js 🙂

CORS error on request to localhost dev server from remote site

Original Answer I finally found the answer, in this RFC about CORS-RFC1918 from a Chrome-team member. To sum it up, Chrome has implemented CORS-RFC1918, which prevents public network resources from requesting private-network resources – unless the public-network resource is secure (HTTPS) and the private-network resource provides appropriate (yet-undefined) CORS headers. There’s also a Chrome flag … Read more

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