webpack-dev-server

You may need an appropriate loader to handle this file type upload image file

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 16:59:34
问题 I am using an image file in react-babel-webpack. But it showing an error that ERROR in ./public/assets/scissors.png Module parse failed: /home/rohit/Desktop/game/public/assets/scissors.png Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected character '�' (1:0) tool.component.js import React from 'react'; import Paper from '../../public/assets/paper.png'; import Rock from '../../public/assets/rock.png'; class Tools extends React

How to setup a proxy using web sockets and angular CLI

这一生的挚爱 提交于 2019-12-07 15:48:19
问题 I have a simple web app built using the angular CLI. I want it to communicate with a backend using web sockets. I have the backend already written and have tested with a simple index.html page that the server can send and receive on sockets. In my angular-cli project I have setup a proxy config file to setup a proxy to the backend. proxy.conf.json { "/sock": { "target": "http://localhost:3000", "changeOrigin": true, "ws": true, "logLevel": "debug" } } Then start the server with the following.

webpack html (ejs) include other templates

北城以北 提交于 2019-12-07 06:11:55
问题 So this is my webpack config : import path from 'path'; var HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { entry: { index: './dev/index.js' }, output: { path: path.join(__dirname, 'dist'), // publicPath: 'http://localhost:3000/', filename: 'bundle.js', chunkFilename: '[id].bundle.js' }, module: { loaders: [ { test: /\.js$/, exclude: path.resolve(__dirname, "node_modules"), loader: 'babel-loader' } ] }, plugins: [ new HtmlWebpackPlugin({ hash: true, template: 'ejs!./dev

React.createElement: type is invalid — expected a string, but got: object

泄露秘密 提交于 2019-12-07 01:57:04
问题 I've just upgraded to Webpack 2.2 today and have been reading through their guides, which are still a work in progress it seems. I am having difficulties setting up my application to use webpack-dev-server with hot module reloading. The guide I was following via the webpack documentation is here, but I am having to modify it to work with a development/production application. https://webpack.js.org/guides/hmr-react/ The two errors I get are the following... Uncaught Error: _registerComponent(.

how to proxy to backend server on certain path?

我们两清 提交于 2019-12-06 19:31:51
问题 Here is the routes config: <Route path='/' component={CoreLayout}> <IndexRoute component={HomeView}/> <Route path='/404' component={NotFoundView}/> <Redirect from='*' to='/404'/> </Route> Here is the proxy config for webpack-dev-server: proxy: { '/service': 'http://localhost:8080' } The express server listens on 3000 port. I hope that all the requests send to http://localhost:3000/service would be transferred to http://localhost:8080, but it seems that react-router handles all the requests

React + Webpack HMR is refreshing the page (not hot loading)

落花浮王杯 提交于 2019-12-06 18:49:15
问题 I'm having a bit of trouble getting the react-hot webpack loader to work correctly. When I load the page I get the following as I would expect: [HMR] Waiting for update signal from WDS... [WDS] Hot Module Replacement enabled. But when I save a change the page automatically hard refreshes the browser (rather than a HMR replacement). //webpack.config.js { entry: { client: 'webpack-dev-server/client?http://localhost:8786', // WebpackDevServer host and port app: "./HelloWorld.tsx" }, devtool:

After update to Angular 6 [WDS] Disconnected on IE after load

半腔热情 提交于 2019-12-06 14:50:37
I updated my Angular Project from 5 to 6. But now I have issues with the Internet Explorer 11. Every time I try to load the live dev server on localhost:4200 the login page renders but immediatly disconnects from the live dev server. All other Browsers work fine, no errors on the console (tried with Edge, Firefox and Chrome) My pollyfills look like this: /** * This file includes polyfills needed by Angular and is loaded before the app. * You can add your own extra polyfills to this file. * * This file is divided into 2 sections: * 1. Browser polyfills. These are applied before loading ZoneJS

webpack-dev-server 和 html-webpack-plugin的使用

痞子三分冷 提交于 2019-12-06 13:07:15
/*--> */ /*--> */ webpack-dev-server的作用:自动编译 1、webpack-dev-server的使用   1)cnpm i webpack-dev-server -D   2)在package.json中配置:   3)终端中输入命令:npm run dev   4)浏览器访问http://localhost:8080/   output file[main.js]托管到“/”,所以可以通过地址http://localhost:8080/main.js来访问   在package.json中配置webpack-dev-server时常用的参数: "dev": "webpack-dev-server --open --port 3000 --hot --host 127.0.0.1"   --open: 自动编译完后打开浏览器   5)修改index.html引入main.js <script src="/main.js"></script> 2、html-webpack-plugin插件的使用 来源: https://www.cnblogs.com/xy-ouyang/p/11986373.html

How do I get webpack-dev-server to accept POST requests

丶灬走出姿态 提交于 2019-12-06 12:04:05
In my project I call: $ webpack-dev-server --history-api-fallback And it starts an express server (I'm assuming) available on localhost:8080 . It works great except that I want to submit a form via POST into an iframe loading my app; localhost:8080 in development and something else in production. I don't expect to do anything with that POST data in development, but in production, it needs to be POST. When I try to use POST however, it cannot find POST / Is there a configuration option or some other solution that will allow me to use the webpack-dev-server ? (I really don't want to have to

Wordpress redirecting to localhost instead of virtual host when being proxied by Webpack Dev Server

只谈情不闲聊 提交于 2019-12-06 07:43:40
问题 I am trying to do a relatively simple set up with: An Apache server with a virtual host for the HTML. Webpack and the Webpack Dev Server for asset reloading and generation. To accomplish this, the Webpack Dev Server proxies the other server to pass through requests that it doesn't know how to handle. Using a basic python server (which works): Start the python webserver on http://localhost:5000. Run npm start. Webpack Dev Server starts and proxies the python server using http://localhost:9090.