What does “The code generator has deoptimised the styling of [some file] as it exceeds the max of ”100KB“” mean?

前端 未结 9 1415
失恋的感觉
失恋的感觉 2020-11-30 19:18

I added a new npm package to my project and require it in one of my modules.

Now I get this message from webpack,

build modulesNote: The code generator

相关标签:
9条回答
  • 2020-11-30 19:48

    This seems to be a Babel error. I'm guessing you use babel-loader, and are not excluding external libraries from your loader test. As far as I can tell, the message is not harmful, but you should still do something like this:

    loaders: [
        { test: /\.js$/, exclude: /node_modules/, loader: 'babel' }
    ]
    

    Have a look. Was that it?

    0 讨论(0)
  • 2020-11-30 19:48

    I tried Ricardo Stuven's way but it didn't work for me. What worked in the end was adding "compact": false to my .babelrc file:

    {
        "compact": false,
        "presets": ["latest", "react", "stage-0"]
    }
    
    0 讨论(0)
  • 2020-11-30 19:51

    This is maybe not the case of original OP question, but: if you exceeds the default max size, this maybe a symptom of some other issue you have. in my case, I had the warrning, but finally it turned into a FATAL ERROR: MarkCompactCollector: semi-space copy, fallback in old gen Allocation failed - JavaScript heap out of memory. the reason was that i dynamically imported the current module, so this ended up with an endless loop...

    0 讨论(0)
提交回复
热议问题