`$ rails assets:precompile` results in errors related to Chunk.js

Hello all!

I recently started running various system tests which requires me to run $ rails assets:clean and/or $ rails assets:precompile from time to time.

Everything was rocking and rolling like normal, until this afternoon, when I started receiving the following error while trying to run assets:precompile :

Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead
    at Chunk.get (/home/linux/Programming/Projects/land_app/node_modules/webpack/lib/Chunk.js:866:9)
    at /home/linux/Programming/Projects/land_app/node_modules/@rails/webpacker/node_modules/extract-text-webpack-plugin/dist/index.js:176:48
    at Array.forEach (<anonymous>)
    at /home/linux/Programming/Projects/land_app/node_modules/@rails/webpacker/node_modules/extract-text-webpack-plugin/dist/index.js:171:18
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/linux/Programming/Projects/land_app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (/home/linux/Programming/Projects/land_app/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.seal (/home/linux/Programming/Projects/land_app/node_modules/webpack/lib/Compilation.js:1342:27)
    at /home/linux/Programming/Projects/land_app/node_modules/webpack/lib/Compiler.js:675:18
    at /home/linux/Programming/Projects/land_app/node_modules/webpack/lib/Compilation.js:1261:4
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/linux/Programming/Projects/land_app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
    at AsyncSeriesHook.lazyCompileHook (/home/linux/Programming/Projects/land_app/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.finish (/home/linux/Programming/Projects/land_app/node_modules/webpack/lib/Compilation.js:1253:28)
    at /home/linux/Programming/Projects/land_app/node_modules/webpack/lib/Compiler.js:672:17
    at eval (eval at create (/home/linux/Programming/Projects/land_app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at /home/linux/Programming/Projects/land_app/node_modules/webpack/lib/Compilation.js:1185:12
    at /home/linux/Programming/Projects/land_app/node_modules/webpack/lib/Compilation.js:1097:9
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

Node packages are, admittedly, not something I’ve messed with very much, especially not in this app. So I’m at a loss as to what may have caused the issue.

Since I’m currently not using any selected node packages in this app, is there a way I can “start over” on a clean slate when it comes to the webpack side of the coin? Is that something that would likely fix whatever issue may be present?

If it’s of any help, this is an app that initially started on the tail-end of Rails 4.x that I’ve pulled through to Rails 5.x, and now Rails 6.x.

I’ll close with a copy of my gemfile. If there’s any other information you need, please don’t hesitate to ask! Thank you in advance for any tips or pointers you can give!

GEM
  remote: https://rubygems.org/
  specs:
    aasm (5.0.8)
      concurrent-ruby (~> 1.0)
    actioncable (6.0.3)
      actionpack (= 6.0.3)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailbox (6.0.3)
      actionpack (= 6.0.3)
      activejob (= 6.0.3)
      activerecord (= 6.0.3)
      activestorage (= 6.0.3)
      activesupport (= 6.0.3)
      mail (>= 2.7.1)
    actionmailer (6.0.3)
      actionpack (= 6.0.3)
      actionview (= 6.0.3)
      activejob (= 6.0.3)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (6.0.3)
      actionview (= 6.0.3)
      activesupport (= 6.0.3)
      rack (~> 2.0, >= 2.0.8)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.2.0)
    actiontext (6.0.3)
      actionpack (= 6.0.3)
      activerecord (= 6.0.3)
      activestorage (= 6.0.3)
      activesupport (= 6.0.3)
      nokogiri (>= 1.8.5)
    actionview (6.0.3)
      activesupport (= 6.0.3)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    active_record_query_trace (1.7)
    activejob (6.0.3)
      activesupport (= 6.0.3)
      globalid (>= 0.3.6)
    activemodel (6.0.3)
      activesupport (= 6.0.3)
    activerecord (6.0.3)
      activemodel (= 6.0.3)
      activesupport (= 6.0.3)
    activestorage (6.0.3)
      actionpack (= 6.0.3)
      activejob (= 6.0.3)
      activerecord (= 6.0.3)
      marcel (~> 0.3.1)
    activesupport (6.0.3)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
      zeitwerk (~> 2.2, >= 2.2.2)
    addressable (2.7.0)
      public_suffix (>= 2.0.2, < 5.0)
    ansi (1.5.0)
    apparition (0.5.0)
      capybara (~> 3.13, < 4)
      websocket-driver (>= 0.6.5)
    area (0.10.0)
      fastercsv (~> 1.5)
    autoprefixer-rails (9.7.6)
      execjs
    aws-eventstream (1.1.0)
    aws-partitions (1.311.0)
    aws-sdk-core (3.95.0)
      aws-eventstream (~> 1, >= 1.0.2)
      aws-partitions (~> 1, >= 1.239.0)
      aws-sigv4 (~> 1.1)
      jmespath (~> 1.0)
    aws-sdk-kms (1.31.0)
      aws-sdk-core (~> 3, >= 3.71.0)
      aws-sigv4 (~> 1.1)
    aws-sdk-s3 (1.63.1)
      aws-sdk-core (~> 3, >= 3.83.0)
      aws-sdk-kms (~> 1)
      aws-sigv4 (~> 1.1)
    aws-sigv4 (1.1.3)
      aws-eventstream (~> 1.0, >= 1.0.2)
    bcrypt (3.1.13)
    better_errors (2.7.0)
      coderay (>= 1.0.0)
      erubi (>= 1.0.0)
      rack (>= 0.9.0)
    bindex (0.8.1)
    binding_of_caller (0.8.0)
      debug_inspector (>= 0.0.1)
    bootstrap-sass (3.4.1)
      autoprefixer-rails (>= 5.2.1)
      sassc (>= 2.0.0)
    bootstrap-will_paginate (1.0.0)
      will_paginate
    brakeman (4.8.1)
    builder (3.2.4)
    bullet (6.1.0)
      activesupport (>= 3.0.0)
      uniform_notifier (~> 1.11)
    bundler-audit (0.6.1)
      bundler (>= 1.2.0, < 3)
      thor (~> 0.18)
    capybara (3.32.1)
      addressable
      mini_mime (>= 0.1.3)
      nokogiri (~> 1.8)
      rack (>= 1.6.0)
      rack-test (>= 0.6.3)
      regexp_parser (~> 1.5)
      xpath (~> 3.2)
    capybara-screenshot (1.0.24)
      capybara (>= 1.0, < 4)
      launchy
    capybara-webkit (1.15.1)
      capybara (>= 2.3, < 4.0)
      json
    childprocess (3.0.0)
    chronic (0.10.2)
    coderay (1.1.2)
    coffee-rails (4.2.2)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.1.6)
    connection_pool (2.2.2)
    content_disposition (1.0.0)
    crass (1.0.6)
    debug_inspector (0.0.3)
    docile (1.3.2)
    down (5.1.1)
      addressable (~> 2.5)
    erubi (1.9.0)
    execjs (2.7.0)
    factory_bot (5.2.0)
      activesupport (>= 4.2.0)
    factory_bot_rails (5.2.0)
      factory_bot (~> 5.2.0)
      railties (>= 4.2.0)
    faker (2.10.2)
      i18n (>= 1.6, < 2)
    fastercsv (1.5.5)
    fastimage (2.1.7)
    ffi (1.12.2)
    formatador (0.2.5)
    fuzzy_match (2.1.0)
    geocoder (1.6.3)
    globalid (0.4.2)
      activesupport (>= 4.2.0)
    guard (2.16.2)
      formatador (>= 0.2.4)
      listen (>= 2.7, < 4.0)
      lumberjack (>= 1.0.12, < 2.0)
      nenv (~> 0.1)
      notiffany (~> 0.0)
      pry (>= 0.9.12)
      shellany (~> 0.0)
      thor (>= 0.18.1)
    guard-compat (1.2.1)
    guard-minitest (2.4.6)
      guard-compat (~> 1.2)
      minitest (>= 3.0)
    i18n (1.8.2)
      concurrent-ruby (~> 1.0)
    image_processing (1.10.3)
      mini_magick (>= 4.9.5, < 5)
      ruby-vips (>= 2.0.17, < 3)
    inline_svg (1.7.1)
      activesupport (>= 3.0)
      nokogiri (>= 1.6)
    jbuilder (2.10.0)
      activesupport (>= 5.0.0)
    jmespath (1.4.0)
    jquery-rails (4.3.5)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (6.0.1)
      railties (>= 3.2.16)
    json (2.3.0)
    launchy (2.5.0)
      addressable (~> 2.7)
    listen (3.2.1)
      rb-fsevent (~> 0.10, >= 0.10.3)
      rb-inotify (~> 0.9, >= 0.9.10)
    loofah (2.5.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    lumberjack (1.2.4)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (0.3.3)
      mimemagic (~> 0.3.2)
    method_source (1.0.0)
    mimemagic (0.3.5)
    mini_magick (4.10.1)
    mini_mime (1.0.2)
    mini_portile2 (2.4.0)
    minitest (5.14.0)
    minitest-reporters (1.4.2)
      ansi
      builder
      minitest (>= 5.0)
      ruby-progressbar
    nenv (0.3.0)
    nio4r (2.5.2)
    nokogiri (1.10.9)
      mini_portile2 (~> 2.4.0)
    notiffany (0.1.3)
      nenv (~> 0.1)
      shellany (~> 0.0)
    papertrail (0.11.0)
      ansi (~> 1.5)
      chronic (~> 0.10)
    pg (1.2.3)
    popper_js (1.16.0)
    pry (0.13.1)
      coderay (~> 1.1)
      method_source (~> 1.0)
    pry-rails (0.3.9)
      pry (>= 0.10.4)
    public_suffix (4.0.4)
    puma (4.3.3)
      nio4r (~> 2.0)
    rack (2.2.2)
    rack-protection (2.0.8.1)
      rack
    rack-proxy (0.6.5)
      rack
    rack-test (1.1.0)
      rack (>= 1.0, < 3)
    rails (6.0.3)
      actioncable (= 6.0.3)
      actionmailbox (= 6.0.3)
      actionmailer (= 6.0.3)
      actionpack (= 6.0.3)
      actiontext (= 6.0.3)
      actionview (= 6.0.3)
      activejob (= 6.0.3)
      activemodel (= 6.0.3)
      activerecord (= 6.0.3)
      activestorage (= 6.0.3)
      activesupport (= 6.0.3)
      bundler (>= 1.3.0)
      railties (= 6.0.3)
      sprockets-rails (>= 2.0.0)
    rails-controller-testing (1.0.4)
      actionpack (>= 5.0.1.x)
      actionview (>= 5.0.1.x)
      activesupport (>= 5.0.1.x)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.3.0)
      loofah (~> 2.3)
    railties (6.0.3)
      actionpack (= 6.0.3)
      activesupport (= 6.0.3)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.20.3, < 2.0)
    rake (13.0.1)
    rb-fsevent (0.10.4)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    redis (4.1.4)
    regexp_parser (1.7.0)
    ruby-progressbar (1.10.1)
    ruby-vips (2.0.17)
      ffi (~> 1.9)
    rubyzip (2.3.0)
    sass-rails (6.0.0)
      sassc-rails (~> 2.1, >= 2.1.1)
    sassc (2.3.0)
      ffi (~> 1.9)
    sassc-rails (2.1.2)
      railties (>= 4.0.0)
      sassc (>= 2.0)
      sprockets (> 3.0)
      sprockets-rails
      tilt
    selenium-webdriver (3.142.7)
      childprocess (>= 0.5, < 4.0)
      rubyzip (>= 1.2.2)
    semantic_range (2.3.0)
    shellany (0.0.1)
    shrine (3.2.1)
      content_disposition (~> 1.0)
      down (~> 5.1)
    sidekiq (6.0.7)
      connection_pool (>= 2.2.2)
      rack (~> 2.0)
      rack-protection (>= 2.0.0)
      redis (>= 4.1.0)
    simple_form (5.0.2)
      actionpack (>= 5.0)
      activemodel (>= 5.0)
    simplecov (0.18.5)
      docile (~> 1.1)
      simplecov-html (~> 0.11)
    simplecov-html (0.12.2)
    simplecov-json (0.2.1)
      json
      simplecov
    spring (2.1.0)
    spring-watcher-listen (2.0.1)
      listen (>= 2.7, < 4.0)
      spring (>= 1.2, < 3.0)
    sprockets (4.0.0)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.1)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (0.20.3)
    thread_safe (0.3.6)
    tilt (2.0.10)
    turbolinks (5.2.1)
      turbolinks-source (~> 5.2)
    turbolinks-source (5.2.0)
    tzinfo (1.2.7)
      thread_safe (~> 0.1)
    uglifier (4.2.0)
      execjs (>= 0.3.0, < 3)
    uniform_notifier (1.13.0)
    web-console (4.0.2)
      actionview (>= 6.0.0)
      activemodel (>= 6.0.0)
      bindex (>= 0.4.0)
      railties (>= 6.0.0)
    webdrivers (4.2.0)
      nokogiri (~> 1.6)
      rubyzip (>= 1.3.0)
      selenium-webdriver (>= 3.0, < 4.0)
    webpacker (5.0.1)
      activesupport (>= 5.2)
      rack-proxy (>= 0.6.1)
      railties (>= 5.2)
      semantic_range (>= 2.3.0)
    websocket-driver (0.7.1)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.4)
    will_paginate (3.3.0)
    xpath (3.2.0)
      nokogiri (~> 1.8)
    zeitwerk (2.3.0)

PLATFORMS
  ruby

DEPENDENCIES
  aasm (~> 5.0.8)
  active_record_query_trace
  apparition (~> 0.5.0)
  area (~> 0.10.0)
  autoprefixer-rails (~> 9.7.5)
  aws-sdk-s3 (~> 1.63.1)
  bcrypt (~> 3.1.11)
  better_errors (~> 2.7)
  binding_of_caller (~> 0.8.0)
  bootstrap-sass (~> 3.4)
  bootstrap-will_paginate (~> 1.0.0)
  brakeman
  bullet (~> 6.0)
  bundler-audit
  capybara (~> 3.12)
  capybara-screenshot (~> 1.0.18)
  capybara-webkit (~> 1.15.0)
  coffee-rails (~> 4.2.2)
  factory_bot (~> 5.2)
  factory_bot_rails (~> 5.2)
  faker (~> 2.10.2)
  fastimage
  fuzzy_match (~> 2.1.0)
  geocoder (~> 1.6.2)
  guard (~> 2.16.0)
  guard-minitest (~> 2.4.6)
  image_processing (~> 1.9)
  inline_svg (~> 1.7.1)
  jbuilder (~> 2.5)
  jquery-rails (~> 4.3.1)
  jquery-ui-rails (~> 6.0.1)
  listen (~> 3.2.1)
  mini_magick (~> 4.10.1)
  minitest (~> 5.11)
  minitest-reporters (~> 1.4.2)
  papertrail (~> 0.11.0)
  pg (~> 1.2.3)
  popper_js (~> 1.16.0)
  pry (~> 0.13.0)
  pry-rails (~> 0.3.9)
  puma (~> 4.0)
  rails (~> 6.0.2)
  rails-controller-testing (~> 1.0.2)
  ruby-vips (~> 2.0)
  sass-rails (~> 6.0.0)
  sassc (~> 2.3.0)
  sassc-rails (~> 2.1.2)
  selenium-webdriver (~> 3.142.7)
  shrine (~> 3.2.1)
  sidekiq (~> 6.0.6)
  simple_form (~> 5.0.2)
  simplecov (~> 0.18.5)
  simplecov-json (~> 0.2)
  spring (~> 2.1.0)
  spring-watcher-listen (~> 2.0.0)
  sprockets (~> 4.0.0)
  turbolinks (~> 5.2.0)
  tzinfo-data
  uglifier (>= 1.3.0)
  web-console (>= 3.3.0)
  webdrivers (~> 4.2.0)
  webpacker (~> 5.0.1)
  will_paginate (~> 3.3.0)

BUNDLED WITH
   2.1.4

Hi @Blake-LeBlanc! I’m surprised to see extract-text-plugin listed. I did not think this was a dependency of the most recent version of @rails/webacker. Is that an explicit dependency in your package.json? What version of @rails/webacker are you on?

Hi @rossta, thank you for following up so quickly!

I was finally able to get it squared away by doing two things

  1. Deleting everything node/webpack related and the rebuilding from scratch with webpacker.
  2. Removing a file in the root directory called .babelrc

I was previously on webpacker v 3.5.5, which, looking back at the diff, shows it did require

"requires": {
  ...
  "extract-text-webpack-plugin": "3.0.2",
  ...
}

which sounds awfully similar.

The “old” package.json file did include a dependency for babel-loader and node-sass, so those could have played a role as well.

"dependencies": {
  ...
  "babel-loader": "^8.1.0",
  "node-sass": "^4.14.1"
},

And the .babelrc file contained

{
  "presets": [
    ...
  ],
  "plugins": [
    "syntax-dynamic-import",
    "transform-object-rest-spread",
    [
      "transform-class-properties",
        {
          "spec": true
        }
    ]
  ]
}

The package.json file I’m working with now is stripped down to

"dependencies": {
  "@rails/webpacker": "5.0.1"  
},
"devDependencies": {
  "webpack-dev-server": "^3.11.0"
}

and as you suspected the extract-text-plugin and related error messages are nowhere in sight :slight_smile:

In the end, it was a great learning experience. Forced me to finally dig into the webpack/webpacker/node/yarn side of things so it’s not near as intimidating as it was at the time of my original post.

Thank you again Ross!

1 Like

Glad you got it figured out!