Webpacker: Staging assets:precompile is incredibly slow on 4.0.0-pre.3

Created on 30 Oct 2018  路  4Comments  路  Source: rails/webpacker

When upgrading from v3.5.5 to v4.0.0.pre.3 to test the pre-release, I noticed that my staging deploy went from taking approx 10-15 minutes to over 2 hours, stuck on the assets:precompile step after Sprockets has completed.

Production deploy is untested.

Would be happy to share any necessary files. Here's my .babelrc if it helps:

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "modules": false,
        "forceAllTransforms": true,
        "useBuiltIns": "entry"
      }
    ],
    "@babel/preset-react"
  ],
  "plugins": [
    "@babel/plugin-transform-destructuring",
    "@babel/plugin-syntax-dynamic-import",
    [
      "@babel/plugin-proposal-object-rest-spread",
      {
        "useBuiltIns": true
      }
    ],
    [
      "@babel/plugin-transform-runtime",
      {
        "helpers": false,
        "regenerator": true
      }
    ],
    [
      "@babel/plugin-transform-regenerator",
      {
        "async": false
      }
    ],
    [
      "@babel/plugin-proposal-class-properties",
      {
        "loose": true
      }
    ]
  ]
}

Most helpful comment

I had a similar issue. Try to move all your source code files out of javascript/packs/, for example javascript/src, and just import your main file in packs.

Example commit with the changes:
https://github.com/honeybadger-io/honeybadger-rails-webpacker-example/commit/5a70ed9728624c7f058a31c34602a76856633e9d

All 4 comments

Can you share the log of assets:precompile execution?

I had a similar issue. Try to move all your source code files out of javascript/packs/, for example javascript/src, and just import your main file in packs.

Example commit with the changes:
https://github.com/honeybadger-io/honeybadger-rails-webpacker-example/commit/5a70ed9728624c7f058a31c34602a76856633e9d

Robert is right, webpacker is probably trying to do more work than you want it to. From the docs:
https://github.com/rails/webpacker/blob/227661b546701e107213aa9b6f83451bc89cf7d5/docs/folder-structure.md#L6

Please use the latest RC, and feel free to open a new issue with more details if this is still an issue.

Was this page helpful?
0 / 5 - 0 ratings