vue cli 3 & webpack-merge & webpack & bug
bug
webpack-merge & bug
webpack-merge ??? '"var"' & "string"
"use strict";
const merge = require("webpack-merge");
const prodEnv = require("./prod.env");
// module.exports = merge(prodEnv, {
// NODE_ENV: "development",
// API_ROOT: "http://10.1.5.202:7777",
// LOG_URL: "http://127.0.0.1:8081/log"
// });
// webpack-merge ??? '"var"' & "string"
module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
API_ROOT: '"http://10.1.5.202:7777"',
LOG_URL: '"http://127.0.0.1:8081/log"'
});
// LOG_URL: "http://localhost:8081/log",
solution
solution
https://itnext.io/implement-nodejs-environment-variables-in-a-modern-webpack-app-df20c27fe5f0
https://nodejs.org/dist/latest-v8.x/docs/api/process.html#process_process_env
if (process.env.NODE_ENV === 'production') {
module.exports = require('./webpack.production.config');
} else {
module.exports = require('./webpack.development.config');
}
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
},
}),
],
webpack 3 documentation
http://docs.w3cub.com/webpack/guides/environment-variables/
https://blog.flennik.com/the-fine-art-of-the-webpack-2-config-dc4d19d7f172
https://stackoverflow.com/questions/49152770/where-can-i-find-the-documentation-for-webpack-3
https://web.archive.org/web/20180216190554/https://webpack.js.org/concepts/
https://github.com/webpack/webpack.js.org/archive/v3.11.0.zip
https://medium.com/webpack/webpack-3-official-release-15fd2dd8f07b
webpack 4
mode
https://webpack.js.org/concepts/mode/
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!