Passing the NODE_ENV value using Webpack via DefinePlugin

后端 未结 2 1493
北恋
北恋 2021-01-11 10:55

I am trying to inject the NODE_ENV value into my code using webpack via DefinePlugin. I checked, more or less, an identical question,

2条回答
  •  走了就别回头了
    2021-01-11 11:13

    The DefinePlugin expects strings so you need to JSON.stringify() any values passed into it.

    new webpack.DefinePlugin({
        PRODUCTION: JSON.stringify(PRODUCTION),
        DEVELOPMENT: JSON.stringify(DEVELOPMENT)
    })
    

提交回复
热议问题