A doubt in webpack

what I don"t understand is" production", which is enclosed in single quotation marks and double quotation marks. String variables need to be wrapped into single and double quotes""."", what is a string variable?

// config/prod.env.js
module.exports = {
  NODE_ENV: ""production"",
  DEBUG_MODE: false,
  API_KEY: ""..."" // this is shared between all environments
}

// config/dev.env.js
module.exports = merge(prodEnv, {
  NODE_ENV: ""development"",
  DEBUG_MODE: true // this overrides the DEBUG_MODE value of prod.env
})

// config/test.env.js
module.exports = merge(devEnv, {
  NODE_ENV: ""testing""
})

Note: string variables need to be wrapped into single and double quotes ""...""
Mar.31,2021

this is not required by webpack, it is required by webpack.definePlugin. The latter will replace the variables in your code with the specified content, which will be used to output the code required by the specific environment.

imagine that your code will be released in two versions, a trial version and an official version. If execution is interrupted when certain conditions are reached in the trial version, you can do this:

if (true) {
  //...
}

so, if the variable is a string, for example: if (VERSION = 'trial') , but you don't put quotation marks, it becomes if (trial =' trial') , then JS will think the previous one is a variable, which will cause some strange problems.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb0799-22db.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb0799-22db.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?