cbll
cbll

Reputation: 7219

Webpack -p slow build "[BABEL]" Note: The code generator has deoptimised the styling of "file.jsx" as it exceeds the max of "500KB"

While running webpack -p this BABEL note is thrown. The build is notoriously slow(takes almost 2 minutes), and specifically hangs at this point(for almost a minute).

The file itself is actually a Leaflet.js dataset of map tiles, saved in a variable and imported into another component. It's almost 16000 lines long.

How can I get around this warning/error, and possibly decrease my webpack -p build time? This file never changes at all, it's completely static. Is there a better way to load and bundle it?

Here's a stacktrace from the first part where it definitely hangs, though not related to the above warning:

[ERROR] loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
[ERROR] parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
[INFO] Hash: 3630895d5243d91f70f9
[INFO] Version: webpack 2.2.1
[INFO] Time: 112723ms

Upvotes: 2

Views: 9535

Answers (2)

FoteiniK
FoteiniK

Reputation: 51

I had the same issue. After searching and trying several things, the following one worked. I included exclude: /node_modules/ on my loader like this:

rules: [
      { test: /\.(js)$/, use: "babel-loader", exclude: /node_modules/ },
      { test: /\.css$/, use: ["style-loader", "css-loader"] }
    ]

I found the above information in this thread.

Upvotes: 2

Sergio Belevskij
Sergio Belevskij

Reputation: 2957

try to add this section into your .babelrc file:

{
  "env": {
    "development" : {
      "compact": false
    }
  },
  ...
}

Upvotes: 1

Related Questions