webpack-dev-server

Django/Webpack - How to serve generated webpack bundles with webpack dev server

◇◆丶佛笑我妖孽 提交于 2020-05-25 05:27:23
问题 Django's 'static' tag generates urls using STATIC_URL, which results in something like '/static/myapp/js/bundle.js' Mean while, webpack-dev-server is serving bundles from the url 'localhost:3000' My question is how do I get Django 'static' template tag to generate a different url ( which points to webpack dev server) for js bundles. Of course I can hardcode it in the template, but that would not be a good solution. Below is my project configuration webpack.config.js const path = require('path

How can I develop locally using a domain name instead of 'localhost:3000' in the url with create-react-app?

痴心易碎 提交于 2020-05-23 10:47:21
问题 I have been developing a small app with create-react-app and a few other libraries i added. Given the planned architecture and some tests i'd like to run with react-router, i would like to be able to run my app locally using a domain mame in the url, so that instead of localhost:3000/ it would be somedomain.com I have tried a few things like ejecting ceate-react-app but im not sure how to modify the webpack config to change the public path, or how to set up some sort of proxy on my machine so

How can I develop locally using a domain name instead of 'localhost:3000' in the url with create-react-app?

安稳与你 提交于 2020-05-23 10:46:49
问题 I have been developing a small app with create-react-app and a few other libraries i added. Given the planned architecture and some tests i'd like to run with react-router, i would like to be able to run my app locally using a domain mame in the url, so that instead of localhost:3000/ it would be somedomain.com I have tried a few things like ejecting ceate-react-app but im not sure how to modify the webpack config to change the public path, or how to set up some sort of proxy on my machine so

How to set multiple env variables using cross-env?

落花浮王杯 提交于 2020-05-23 08:32:12
问题 Does anyone know how to set multiple env vars using cross-env ? I was trying running the following script without success. "cross-env NODE_ENV=production DTM_ENV=staging webpack --config internals/webpack.prod.babel.js --color -p --progress" On console.log(process.env) it only displays NODE_ENV: "production" . 回答1: Webpack doesn't have access to env variables after the build is done, so you need to expose those variables by adding this into Webpack config into plugins: new webpack

Error in Entry Module not found - in Webpack Config file

落爺英雄遲暮 提交于 2020-05-15 05:04:13
问题 I am trying to setup webpack for ReactJs. I am clueless what is wrong with my Webpack Config File which gives me ERROR in Entry module not found: Error: Can't resolve './src' in 'D:\wd\javascript\Projects\reactjs-basics CODE IS HERE - Two files "Webpack.config.js " and "Package.json" Webpack.config.js code is : var webpack = require('webpack'); var path = require('path'); var DIST_DIR = path.resolve(__dirname,'dist'); var SRC_DIR = path.resolve(__dirname,'src'); var config = { entry: SRC_DIR+

Error in Entry Module not found - in Webpack Config file

我的未来我决定 提交于 2020-05-15 05:02:20
问题 I am trying to setup webpack for ReactJs. I am clueless what is wrong with my Webpack Config File which gives me ERROR in Entry module not found: Error: Can't resolve './src' in 'D:\wd\javascript\Projects\reactjs-basics CODE IS HERE - Two files "Webpack.config.js " and "Package.json" Webpack.config.js code is : var webpack = require('webpack'); var path = require('path'); var DIST_DIR = path.resolve(__dirname,'dist'); var SRC_DIR = path.resolve(__dirname,'src'); var config = { entry: SRC_DIR+

WordPress redirecting to siteurl when accessed via webpack-dev-server proxy

人盡茶涼 提交于 2020-05-10 18:54:53
问题 This question has historical value, so I'm updating it a bit. It's the top result for "webpack-dev-server wordpress redirect" in Google. While the accepted solution worked for Webpack 2, it might not work anymore. If it doesn't you can refer to my wordpress-theme-base repository, which is built using Webpack 4. First of all, this is related to Wordpress redirecting to localhost instead of virtual host when being proxied by Webpack Dev Server. I'm facing a similar problem, but the only

I can't run a docker container of my reactjs app

老子叫甜甜 提交于 2020-04-30 06:24:50
问题 I'm new with docker and i tried to run a container of create-react-app image so this is the steps that i have done : 1- npx create-react-app frontend 2- I created a Dockerfile.dev like below: FROM node:alpine WORKDIR '/app' COPY package.json . RUN npm install COPY . . CMD ["npm" , "run" , "start"] 3- I used this command to build the image : docker build -f Dockerfile.dev . 4- When i run the container using the image id provided : docker run -p 3000:3000 my_docker_image_id Nothing happens as

React Router v4 nested routes not work with webpack-dev-server

吃可爱长大的小学妹 提交于 2020-04-11 07:30:27
问题 I try to setup nested routes for my react app like this / -> Home Page /about -> About Page /protected -> protected default page /protected/page1 -> protected page 1 It works fine in codesandbox (https://codesandbox.io/s/react-router-nested-route-utqy7) React 16.8.1 React Router 4.3.1 But when I set the same thing up with webpack-dev-server (3.7.1), it can only reach / and can't reach to the rest routes. My file structure is like ├── package.json ├── src │ ├── index.jsx │ └── index.html ├──

React Router v4 nested routes not work with webpack-dev-server

烂漫一生 提交于 2020-04-11 07:30:08
问题 I try to setup nested routes for my react app like this / -> Home Page /about -> About Page /protected -> protected default page /protected/page1 -> protected page 1 It works fine in codesandbox (https://codesandbox.io/s/react-router-nested-route-utqy7) React 16.8.1 React Router 4.3.1 But when I set the same thing up with webpack-dev-server (3.7.1), it can only reach / and can't reach to the rest routes. My file structure is like ├── package.json ├── src │ ├── index.jsx │ └── index.html ├──