Error: Cannot find module ‘webpack-cli/bin/config-yargs’
You could try changing webpack-dev-server to webpack serve in your npm run script inside package.json
You could try changing webpack-dev-server to webpack serve in your npm run script inside package.json
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
devServer: { static: ‘./’ } I should read the errors more closely. The above object made my config work again.
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
npm install –save-dev webpack is not enough. You also have to install the following: npm install –save-dev webpack-dev-server And optionally, you can also install: npm install –save-dev webpack-dev-middleware webpack-hot-middleware
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
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
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 🙂
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
Seems Webpack watch doesn’t work if the file is not saved directly. Please try turning ‘Safe write‘ option ( Settings | Appearance & Behavior | System Settings | Use “safe write” (save changes to temporary file first)) off. In 2020.* the option name is Back up files before saving