webpack-dev-server

how to have use own jade file for webpack?

爷,独闯天下 提交于 2019-12-03 16:19:09
I'm new to webpack and trying to figure out how to use my own html file in the webpack-dev-server, as well as my webpack build. in my app.js I have: require('!jade!index.jade') but that does not make an index.html as I would expect. Instead, it seems at best I can get a string output of my html, which isn't what I want: var jade = require('!jade!index.jade') jade() //outputs my html How do I get it to output an index.html file? How do I get the webpack-dev-server to use that html file? I should also mention my jade file will likely reference stylus files I use jade-html-loader with the

Multi-project build and dynamically loading modules with webpack

筅森魡賤 提交于 2019-12-03 15:48:19
I have a potentially large Angular 2 application which we are going to split into multiple pieces (it can be considered as bundles within the WebPack terminology). Moreover we are going to build and deploy them separately. So that different pieces of the application can be dynamically loaded from the main application (not within the same web application - within multiple running services which can be on different physical hosts). Webpack does bundling pretty fast and good. But as I know from the output it uses complicated internal format (using module numbers mapped to the actual paths/names).

Getting webpack hot updating to work correctly in my isomorphic web app

守給你的承諾、 提交于 2019-12-03 14:30:57
I'm creating a webapp with a node/express backend and a react frontend. I got (I think) most of it up and running, but the last step of getting the browser to perform a hot refresh does not work as intended. I'll try to post all the relevant setup here. Please let me know if you require anything else to find out where I have done a mistake: I start up my application with node ./server/index.js webpack.config.js var path = require('path'); var webpack = require('webpack'); let webpackConfig = { name: 'server', output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js', publicPath: '

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

别等时光非礼了梦想. 提交于 2019-12-03 13:31:26
问题 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:{

React nested route fails to load on refresh

这一生的挚爱 提交于 2019-12-03 13:05:44
问题 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}>

第三方web ide开发环境下vuejs开发HMR环境搭建-码农这样开发是快乐的!

爱⌒轻易说出口 提交于 2019-12-03 11:41:17
vuejs是一个非常优秀的前端框架,利用该框架可以快速开发出任何web app,之所以vuejs开发非常高效快捷,其中最重要的一点就是利用webpakc提供的HMR(热模块替换)特性,可以边写vue组件,边实时看效果。 而很多时候,虽然本地我们可能已经搭建了vuejs的开发环境,但是很多时候我们需要做一个小小的实验,不希望对自己开发环境有污染。另外我们知道开发环境最稳定兼容性最好的环境还是linux,我们虽然可以搭建自己的linux开发环境,但是并不是每个时候都适合化大量时间去搭建环境,因此我们需要一个快速启动的linux开发测试环境。这几种情况下,第三方的web ide就是一个非常好的手段。 其中 codeanywhere 就是一个非常优秀的代表,其环境本质上是用linux的docker容器构建出来的,每一个人的环境都是一个独立隔离的容器环境,可以随时启动开始写代码调试看效果,不用的时候就可以关闭或者删除。 但是在使用这种web ide时有几个需要解决的问题: 1. 由于容器是在防火墙的后面,而我们webpack构建后的serve url port外界无法访问 这一点比较好解决,因为codeanywhere已经考虑到这个方面,可以使用http://port-xx.yy.com/的方式路由到codeanywhere,它内部做NAT转换可以访问到后端的serve entry.

Webpack hmr: __webpack_hmr 404 not found

三世轮回 提交于 2019-12-03 10:47:46
I'm using webpack-dev-server for hot module replacement. It's working just fine, but this error keeps showing up in the console every couple of seconds: GET http://mysite:8080/__webpack_hmr 404 (Not Found) . Here's my webpack.config.js: var webpack = require('webpack'), hostname = 'mysite', port = 8080; module.exports = { entry: [ 'babel-polyfill', './src/js/main.js', './dev/requireCss.js', 'webpack/hot/dev-server', // I'm assuming the fault lies in the following line, but I can't figure out what's wrong 'webpack-hot-middleware/client?path=http://'+hostname+':'+port+'/__webpack_hmr' ], output:

Webpack creating large file with small project

余生颓废 提交于 2019-12-03 08:37:41
问题 I got my webpack generating a large main.js file (1.7mb) with a small project of ~20-30 files less than 100 lines each. The dependencies required are few in number (React, Fluxible) and I am using every optimize plugin I can understand: module.exports = { output: { path: './build', publicPath: '/public/', filename: '[name].js' }, debug: false, devtool: 'eval', target: 'web', entry: [ 'bootstrap-sass!./bootstrap-sass.config.js', './client.js', ], stats: { colors: true, reasons: false },

Webpack 基础配置使用-简单学习笔记01

大憨熊 提交于 2019-12-03 08:09:52
webpack起步学习 安装webpack 创建一个index.html文件 注意emmet的小技巧 例如: li*10{这是第$个标签} 创建一个main.js文件,操作html中的li使其隔行变色 js文件中用到了jquery,所以npm i jquery -s安装一下jquery 由于main.js包含了es6的高级语法,浏览器不认识import语法,所以需要用webpack处理一下 webpack ./main.js -o ./dist/bundle.js 注意新版webpack的语法和旧版的区别 -o 这样处理过后的main.js文件就变成了dist文件夹内的bundle.js 用webpack处理了包含高级语法的main.js,接下来怎么运行项目呢?? 依旧利用传统方式,用script标签把bundle.js引入index.html中 再次运行index.html标签即可 但是每次修改了文件之后,都要重新运行 webpack ./main.js -o ./dist/bundle.js 来重新打包编译为bundle.js文件才可以 怎样再简化一点呢??? 创建一个 webpack.config.js 文件,来对 webpack 进行配置一下 在 webpack 配置文件内配置好 webpack 打包的入口 entry 和 出口文件 output 的路径和名字

Webpack dev server reload doesn't work on virtual box

自闭症网瘾萝莉.ら 提交于 2019-12-03 07:27:01
问题 I'm running a webpack server on virtual box with Ubuntu 15.10 using vagrant over mac OSX. The webpack config is pretty clean: var HtmlWebpackPlugin = require('html-webpack-plugin'); var path = require('path'); var webpack = require('webpack'); var MINIFY = process.env.MINIFY === true; var FRONTEND_ROOT = './static' var SRC_PATCH = FRONTEND_ROOT + '/scripts'; var BUILD_PATH = './dist'; module.exports = { entry: SRC_PATCH + '/main.js', devtool: 'source-map', output: { path: BUILD_PATH, filename