webpack-2

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