webpack-dev-server

Enable single page app react hot reload webpack

≯℡__Kan透↙ 提交于 2019-12-19 19:49:23
问题 I have some problems setting up a single page react app using react router with the webpackdevserver. If I use browserhistory webpack has some problems when entering a nested route url (/client/view for example). This could be solved adding apiFallback but hot reload does still have a problem. It tries to load the hot-update.json file from the deep url (/client/view/hot-update.json) which does not exist and therefor fails and reloads the page. How can i tell hotreload to always load the hot

Webpack dev server cannot get `http://localhost/8080/bundle.js`

痴心易碎 提交于 2019-12-19 10:41:46
问题 Given this config: var webpack = require('webpack'); const path = require('path') module.exports = { entry: "./src/index.js", output: { path: path.join(__dirname, 'dist'), publicPath: path.join(__dirname, 'dist'), filename: "bundle.js" }, devServer: { contentBase: "./dist", // hot: true, } } Why won't webpack-dev-server server my app properly? I have 0% understanding of localhost, vs localhost/webpack-dev-server, vs publicPath, vs contentBase, etc.. I know all of these paths, and

Problems with vue router (history mode) in development server Vue.js - “Cannot GET /config”

纵然是瞬间 提交于 2019-12-19 10:23:17
问题 I just wanted to setup my vue project with the full webpack template, use vue router and link different urls to different components. The src/router/index.html is the following: import Vue from 'vue'; import Router from 'vue-router'; // eslint-disable-next-line import Home from '../pages/home.vue'; // eslint-disable-next-line import Config from '../pages/config.vue'; Vue.use(Router); export default new Router({ mode: 'hash', routes: [ { path: '/', component: Home }, { path: '/config',

Can't get Webpack 2 HMR React to work

不打扰是莪最后的温柔 提交于 2019-12-18 09:04:22
问题 Currently I'm struggling to get HMR working in my Webpack 2 setup. I'll explain my entire setup so I hope this is enough for someone to understand what's happening. The structure of my project: config dev.js prod.js dist css js index.html node_modules src components // some JavaScript components shared stylesheets index.js .babelrc package.json webpack.config.js This are the contents of my webpack.config.js file, placed in the root of my project: function buildConfig(env) { return require('.

Mocha tests don't run with Webpack and mocha-loader

*爱你&永不变心* 提交于 2019-12-17 22:29:44
问题 Background I am porting some npm scripts to Webpack loaders to better learn how Webpack works and I’ve got everything working except for my Mocha tests: I have one failing test, but it is not showing that Mocha is being run with the mocha-loader or that the test is failing: Question What do I need to do differently to get all src/**/*.test.js files to run with with Mocha in Webpack? Steps to reproduce Clone https://github.com/trevordmiller/webpack-loaders-playground Run npm test to see how

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

会有一股神秘感。 提交于 2019-12-17 21:40:57
问题 I am using webpack-dev-server for development with html-webpack-plugin to generated the index.html with revision sources. The thing is every time I change the index.html the bundle system will not rebuild again. I know the index is not in the entry, but is there a way to solve this? 回答1: 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

Webpack - background images not loading

落花浮王杯 提交于 2019-12-17 18:48:20
问题 I'm fairly new to webpack but having some problems with css-loader or file-loader. I'm trying to load a background-image but it doesn't work quite right. The background-image isn't shown, even though the devtools show the background-image style. If I copy the background-image style to the element.style block, everything works fine. Am I making a stupid mistake somewhere? The body tag should have a background image. The style appears in the developer tools and there are no errors: I can load

How to serve an Angular 2 dist folder index.html

女生的网名这么多〃 提交于 2019-12-17 18:22:20
问题 I'm using this angular 4 seed app: https://github.com/2sic/app-tutorial-angular4-hello-dnn It uses webpack and works fine. It only seems to serve the dev files and not the dist/ folder. I want to ng serve the dist folder. Not sure the command to do this or if I need to install a lite server or something. I run this command to create the dist folder (which works fine): g build --prod --aot --output-hashing=none Now I want to run this build in the browser. 回答1: You can use http-server for doing

webpack-dev-server does not watch for my file changes

*爱你&永不变心* 提交于 2019-12-17 17:36:51
问题 When I change my files while webpack-dev-server is running, the bundle's files are not updated. Here are my webpack.config.js and package.json files, as you can see from my npm script, I've solved running webpack watch and webpack-dev-server in the same command ( npm run watch & webpack-dev-server --content-base ./ --port 9966 ): webpack.config.js: 'use strict'; var ReactStylePlugin = require('react-style-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); var

Multiple html files using webpack

喜夏-厌秋 提交于 2019-12-17 17:28:43
问题 I'm trying to do something in a project that I'm not sure if it is possible, I am in a wrong way or misunderstanding something. We are using webpack, and the idea is to serve more than one html file. localhost:8181 -> serves index.html localhost:8181/example.html -> serves example.html I'm trying to do it by setting multiple entry points, following the documentation: The folder structure is: / |- package.json |- webpack.config.js /src |- index.html |- example.html | /js |- main.js |- example