webpack-dev-server

How to run Webpack Dev Server --https --hot --inline

强颜欢笑 提交于 2019-12-03 06:50:25
Is there a way to leverage running the webpack-dev-server on https when configuring using CLI? The problem is the connection to socket.io is over http and not https . A workaround exists, but its very annoying. Manually include https webpack-dev-server in your index.html <script src="https://localhost:8080/webpack-dev-server.js"></script> Configure each end point to include webpack/hot/only-dev-server . app: [ 'webpack/hot/only-dev-server', './app.js' ], // ... more entry points that include the same [] ... Yes there is a way to configure webpack-dev-server on https when configuring using CLI.

Customise ng serve to proxy calls to /api?

▼魔方 西西 提交于 2019-12-03 05:38:40
问题 I created a new application with ng CLI, works like a charm: ng new babysteps cd babysteps ng serve ng serve uses webpack to assemble the app. To fully test it, I need to serve /api... from my API mock server (specifically the POST requests). How can I customise the web server used, to redirect that one URL pattern? The Webpack dev server has a proxy setting, but it seems (?) ng serve doesn't have a config file (or I didn't get). Do I need to create a webpack.config.js or create/edit some

Change hard coded url constants for different environments via webpack

余生长醉 提交于 2019-12-03 05:36:21
问题 I have a ApiCaller.js module which generate calls to our api server to get data. It has const field API_URL which points to server url. This API_URL const changes for dev and prod environments. So when I need to deploy to dev environment I need to change that url ( API_URL ) manually to point to dev-api-server and vice-versa. I want these configuration parameters outside the code and during build process I want to change them dynamically so that I can build with different settings. I am using

“Invalid Host Header” in When running React App

喜夏-厌秋 提交于 2019-12-03 05:34:56
I am having one simple project of React JS and I am deploying into OSE. Also I am using below dependencies in my project. "webpack": "^2.2.0", "webpack-dev-server": "^1.14.1", "react": "^15.5.4", "react-router-dom": "^4.1.1" also I am running my project through below build script. "build": "SET NODE_ENV=production && webpack-dev-server --host 0.0.0.0 --inline --history-api-fallback --content-base . " Everything goes fine in OSE and Webpack is compiled successfully. But on accessing the url it shows "Invalid Host Header" on the webpage. Could anyone help on this. Somewhat New in React. Thanks

webpack-dev-server的使用

房东的猫 提交于 2019-12-03 05:26:16
   1.安装   npm install webpack-dev-server --save-dev   ps:为保证webpack-dev-server能正常运行,请确认在本地项目中下载了webpack的包,可以通过package.json来查看有无下载   2.运行    1.使用npx命令运行 npx webpack-dev-server   2.使用npm运行     1.首先配置package.json //在script内新增dev键 "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "build": "webpack", "dev":"webpack-dev-server --open --contentBase dist --hot" }, //参数说明 /* --open 执行命令时自动打开页面 --contentBase dir 打开时显示的文件 --hot 每次更新资源文件,不用更新所有资源,只更新部分,相当于加了一个补丁。 */     2.运行命令 npm run dev   3.修改引用包文件的页面文件(*.html) <!doctype html> <html> <head> <title>起步</title> </head> <body> <!--

How to setup a webpack dev server using both historyApiFallback and proxying remote api requests?

纵然是瞬间 提交于 2019-12-03 04:28:18
I have a react application which uses react-router , so it's making use of HTML5 history API, I've tried historyApiFallback set to true to serve 404 paths serving the same index.html instead of returning the HTTP response. That single page application does some requests to a remote API server, that's why I also need to proxy some requests to the express server I'm also running while developing. Web react application is served on port 3000 and API runs on port 3001. So I've tried: devServer:{ contentBase: 'src/www', //Relative directory for base of server devtool: 'eval', hot: true, //Live

React nested route fails to load on refresh

末鹿安然 提交于 2019-12-03 03:26:26
I have a React app with navigation powered by react-router that I run in development with webpack-dev-server and the history fallback option enabled. Here is the routes I have defined in my index.js ReactDOM.render(( <Router history={browserHistory}> <Route path="/" component={App}> <IndexRedirect to="/intro" /> <Route path="/intro" component={Intro} /> <Route path="/device" component={Device} /> <Route path="/clothing" component={Clothing} /> <Route path="/build" component={Build}> <IndexRedirect to="/build/pattern" /> <Route path="/build/pattern" component={Pattern} /> <Route path="/build

webpack-dev-server proxy dosen&#039;t work

匿名 (未验证) 提交于 2019-12-03 02:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to proxy /v1/* to http://myserver.com , and here is my script devServer: { historyApiFallBack: true, // progress: true, hot: true, inline: true, // https: true, port: 8081, contentBase: path.resolve(__dirname, 'public'), proxy: { '/v1/*': { target: 'http://api.in.uprintf.com', secure: false // changeOrigin: true } } }, but it doesn't work, 回答1: Update: thanks to @chimurai, setting changeOrigin: true is important to make it work. Underneath webpack-dev-server passes all the proxy configuration to http-proxy-middleware , from the

webpack bundle.js not found

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I use webpack dev server, but can't access my bundle.js file. Edit: I am using this webpack config without bower-webpack-plugin . package.json { "name": "react_modules", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "start": "npm run serve | npm run dev", "serve": "./node_modules/.bin/http-server -p 8080", "dev": "webpack-dev-server -d --progress --colors --port 8090" }, "author": "", "license": "ISC", "devDependencies": { "babel-core": "^6.0.20", "babel-loader": "^6.0.1", "babel-preset-es2015": "^6.0.15",

historyApiFallback doesn&#039;t work in Webpack dev server

匿名 (未验证) 提交于 2019-12-03 01:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I use Webpack dev server and browserHistory in React Router to manipulate with urls by HTML5 History API. historyapifallback-option does not work in my webpack config file. After refreshing http://localhost:8080/users or http://localhost:8080/products I got 404. webpack.config.js var webpack = require('webpack'); var merge = require('webpack-merge'); const TARGET = process.env.npm_lifecycle_event; var common = { cache: true, debug: true, entry: './src/script/index.jsx', resolve: { extensions: ['', '.js', '.jsx'] }, output: {