menu

arrow_back How do I use WebpackDefinePlugin to use in other plugins?

by
1 vote
Hello, I need to do something like
module.exports = defineConfig({
configureWebpack: {
plugins: [

new webpack.DefinePlugin({
APP_NAME: JSON.stringify("myApp"),
}),
new HtmlWebpackPlugin({
title: APP_NAME + " official"
})

]
}
});
Since modules are exported at the same time defines inside them do not work, what analogue can be used

1 Answer

by
 
Best answer
0 votes
Individual constants? 0_o
const {APP_NAME} = require('./constants');

new webpack.DefinePlugin({
APP_NAME: JSON.stringify(APP_NAME),
}),
new HtmlWebpackPlugin({
title: APP_NAME + " official"
})