recently, a multi-page application packaging vue is being built with webpack. Some statistical codes (mainly the introduction of js) choose whether to add to the page according to the difference between the test environment and the production environment. The test environment and the production environment have been distinguished by the value of process.env.NODE_ENV, but they still do not know whether to load the statistical js according to the environment
.new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify("test")
})
to put it more generally, I don"t know how to choose whether to load a js based on the value of a variable