如何摆脱"Download the react dev tools "?


new webpack.DefinePlugin({
'__REACT_DEVTOOLS_GLOBAL_HOOK__': '({ isDisabled: true })'
})

我看到建议使用它的评论,但我不知道这应该去哪里。它应该进入webpacker/开发.js。即使我把它放在那里,我仍然会看到控制台日志

这应该属于config/webpack/environment.jsconfig/webpack/development.js

尝试将其插入config/webpack/environment.js

const { environment } = require('@rails/webpacker')
// ... other code
const webpack = require('webpack')
environment.plugins.append('DefinePlugin', new webpack.DefinePlugin({
'__REACT_DEVTOOLS_GLOBAL_HOOK__': '({ isDisabled: true })'
}))
// ... other code
module.exports = environment

或进入config/webpack/development.js

process.env.NODE_ENV = process.env.NODE_ENV || 'development'
const environment = require('./environment')
const webpack = require('webpack')
environment.plugins.append('DefinePlugin', new webpack.DefinePlugin({
'__REACT_DEVTOOLS_GLOBAL_HOOK__': '({ isDisabled: true })'
}))
module.exports = environment.toWebpackConfig()

相关内容

  • 没有找到相关文章

最新更新