添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
谈吐大方的盒饭  ·  AttributeError: ...·  1 月前    · 
老实的红豆  ·  QT软件开发: ...·  1 年前    · 
谦虚好学的铁板烧  ·  [Day ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

When I run npm run build in my react app I get the following warning: static/js/widget.js contains invalid source map .

When I remove the UglifyJs settings in my webpack config the build process passes without any warnings.

My Webpack config (only parts which are relevant regarding the sourcemap):

// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
module.exports = {
  // Don't attempt to continue if there are any errors.
  bail: true,
  mode: 'production',
  // We generate sourcemaps in production. This is slow but gives good results.
  // You can exclude the *.map files from the build during deployment.
  devtool: shouldUseSourceMap ? 'source-map' : false,
plugins: [
    new UglifyJsPlugin({
      uglifyOptions: {
        sourceMap: shouldUseSourceMap,
        warnings: false,
        compress: {
          comparisons: false
        output: {
          comments: false,
          ascii_only: true
                I am also facing the same issue and I figured out that, with Webpack 3 and Ugify I dont see this issue, whereas if I am using Webpack4 the warning is thrown. Trying to dig further. Let me know if you found some solution
– coderHASH64codingHASH46code
                Apr 30, 2020 at 15:23
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.