Can webpack add logical optional packaging code to the JS file when packaging js?

there is a requirement to selectively package the code in the js file when packaging using webpack, just like the plug-in packaged by HTML, using the template syntax of the package to selectively package HTML?


provides an idea to use webpack.DefinePlugin () to define the env variable, and then optionally package it according to the variable followed by running the command. For example,
1, define the variable

   
as shown in the figure, I want to configure the data on the right as a variable, and then go to JS to determine whether or not to indexOf a certain piece of JS code. But after it is packaged, it becomes the format on the left, and there is no way to take

.
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-1e39860-431fe.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-1e39860-431fe.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?