webpack-dev-server

React - react-scripts publicPath

时间秒杀一切 提交于 2021-02-20 19:02:10
问题 Is there possibility to override publicPath in react-scripts for dev env. I use symfony and I include react app inside twig so I had to change assets to serve from http://localhost:3000/static/js/bundle.js - this works fine but I have problem with static files because they are rendered in browser as '/static/media/logo.813ua.png' and my current url is http://localhost:8000 What I did is I run yarn eject and modify in webpack.config.dev.js: var publicPath = 'http://localhost:3000/' and

React - react-scripts publicPath

血红的双手。 提交于 2021-02-20 19:00:12
问题 Is there possibility to override publicPath in react-scripts for dev env. I use symfony and I include react app inside twig so I had to change assets to serve from http://localhost:3000/static/js/bundle.js - this works fine but I have problem with static files because they are rendered in browser as '/static/media/logo.813ua.png' and my current url is http://localhost:8000 What I did is I run yarn eject and modify in webpack.config.dev.js: var publicPath = 'http://localhost:3000/' and

Listen for hot update events on the client side with webpack-dev-derver?

只愿长相守 提交于 2021-02-18 18:08:58
问题 This is a bit of an edge case but it would be helpful to know. When developing an extension using webpack-dev-server to keep the extension code up to date, it would be useful to listen to "webpackHotUpdate" Chrome extensions with content scripts often have two sides to the equation: Background Injected Content Script When using webpack-dev-server with HMR the background page stays in sync just fine. However content scripts require a reload of the extension in order to reflect the changes. I

How to use Webpack to combine JSON files from all subdirectories into one?

不问归期 提交于 2021-02-18 13:51:30
问题 Say I have a directory structured like this: 1. folder A 1a. some_file.js 1b. data.json 2. folder B 2a. folder B1 2a1. other_file.json 2a2. data.json 2b. folder B2 2b1. data.json 3. output.json Is there a webpack loader that can combine data.json in all subfolders, and output it to output.json ? I've found https://www.npmjs.com/package/json-files-merge-loader that seems to do something similar, but it seems to ask for each path to data.json , while I need something that goes through all

How to use Webpack to combine JSON files from all subdirectories into one?

℡╲_俬逩灬. 提交于 2021-02-18 13:51:29
问题 Say I have a directory structured like this: 1. folder A 1a. some_file.js 1b. data.json 2. folder B 2a. folder B1 2a1. other_file.json 2a2. data.json 2b. folder B2 2b1. data.json 3. output.json Is there a webpack loader that can combine data.json in all subfolders, and output it to output.json ? I've found https://www.npmjs.com/package/json-files-merge-loader that seems to do something similar, but it seems to ask for each path to data.json , while I need something that goes through all

webpack-dev-server how to reload css without page refresh

半城伤御伤魂 提交于 2021-02-18 06:47:08
问题 When I change styles in my .vue files and .css files, I dont' want the page to refresh, and I want the style auto change. But now page always refresh when I change the styles. I'm using the vue-cli to generate the webpack config file. as below webpack.dev.conf.js const devWebpackConfig = merge(baseWebpackConfig, { module: { rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: false }) }, // cheap-module-eval-source-map is faster for development devtool: config.dev

How to access webpack config variable in other js file

会有一股神秘感。 提交于 2021-02-11 12:38:10
问题 I am running following command to run the app locally npm run start package.json ... "scripts": { "start": "concurrently --kill-others --kill-others-on-fail -p name --names \"config\" \"npm run start:config\"", "build": "npm run build:config", "build:config": "webpack --config ./webpack.config.config.js -p", "start:config": "webpack-dev-server --config ./webpack.config.config.dev.js --port 4200" }, ... I am trying to access env mode in scripts.js defined in webpack config js as shown below

How to run ng serve with PathLocationStrategy while falling back to index.html when page is refreshed

情到浓时终转凉″ 提交于 2021-02-11 06:48:15
问题 For some reasons (e.g Hiding the # from the user), we would like to use PathLocationStrategy as the routing strategy for our Angular 8 Application. We are about to fallback to index.html while deploying the application to an Nginx server. But the problem we are facing is, when we run ng serve locally, the application won't bootstrap when page is refreshed. I have tried to use a custom webpack config to enable devServer.historyApiFallback, it doesn't work. I have also read through quite a few

This site can’t be reached docker-compose

强颜欢笑 提交于 2021-02-11 02:10:18
问题 I am trying to use docker-compose for react-typescript application with webpack-dev-server below is my Dockerfile FROM node:lts-slim RUN mkdir -p /usr/src/app WORKDIR /usr/src/app EXPOSE 3000 CMD [ "npm", "start" ] "start": "webpack-dev-server --port 3000" this package.json line docker-compose.yml version: "3" services: frontend: container_name: awesome_web build: context: ./client dockerfile: Dockerfile image: webpack ports: - "3000:3000" volumes: - ./client:/usr/src/app I executed command

This site can’t be reached docker-compose

依然范特西╮ 提交于 2021-02-11 02:02:21
问题 I am trying to use docker-compose for react-typescript application with webpack-dev-server below is my Dockerfile FROM node:lts-slim RUN mkdir -p /usr/src/app WORKDIR /usr/src/app EXPOSE 3000 CMD [ "npm", "start" ] "start": "webpack-dev-server --port 3000" this package.json line docker-compose.yml version: "3" services: frontend: container_name: awesome_web build: context: ./client dockerfile: Dockerfile image: webpack ports: - "3000:3000" volumes: - ./client:/usr/src/app I executed command