Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 6 server just stopped compiling webpack

I have a really weird thing happening.

I was working on this project on my development environment and when I used to start the Rails server,

It would compile webpack on the first browser request.

Now, all the sudden, this is not happening, causing all the javascript and style to fail and the app is not rendered properly.

The Rails server console does not even show the [Webpacker] Compiling… line

If I start the webpack-dev-server myself, it works. But for some reason the rails server has just stopped doing it on its own. I have changed the line webpack_compile_output: false to true in webpacker.yml but the rails server still doesn't show anything that has to do with Webpack.

It's really strange. I haven't added any gems or updated any versions of node or webpack. I did update Git globally on my machine from version 1.9 to version 2.24 but that's about it.

Any ideas?

Update: (As Requested, here is the content of my config/wenpacker.yml

default: &default
  source_path: app/javascript
  source_entry_path: packs
  public_root_path: public
  public_output_path: packs
  cache_path: tmp/cache/webpacker
  check_yarn_integrity: false
  webpack_compile_output: true

  # Additional paths webpack should lookup modules
  # ['app/assets', 'engine/foo/app/assets']
  resolved_paths: []

  # Reload manifest.json on all requests so we reload latest compiled packs
  cache_manifest: false

  # Extract and emit a css file
  extract_css: false

  static_assets_extensions:
    - .jpg
    - .jpeg
    - .png
    - .gif
    - .tiff
    - .ico
    - .svg
    - .eot
    - .otf
    - .ttf
    - .woff
    - .woff2

  extensions:
    - .mjs
    - .js
    - .sass
    - .scss
    - .css
    - .module.sass
    - .module.scss
    - .module.css
    - .png
    - .svg
    - .gif
    - .jpeg
    - .jpg

development:
  <<: *default
  compile: true

  # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
  check_yarn_integrity: false
   # Reference: https://webpack.js.org/configuration/dev-server/
  dev_server:
    https: false
    host: localhost
    port: 3035
    public: localhost:3035
    hmr: false
    # Inline should be set to true if using HMR
    inline: false
    overlay: true
    compress: true
    disable_host_check: true
    use_local_ip: false
    quiet: false

    headers:
      'Access-Control-Allow-Origin': '*'
    watch_options:
      ignored: '**/node_modules/**'


test:
  <<: *default
  compile: true

  # Compile test packs to a separate directory
  public_output_path: packs-test

production:
  <<: *default

  # Production depends on precompilation of packs prior to booting for performance.
  compile: false

  # Extract and emit a css file
  extract_css: true

  # Cache manifest.json for performance
  cache_manifest: true

like image 631
Dan Avatar asked Dec 06 '19 17:12

Dan


1 Answers

If webpacker stops responding to changes in application.scss or application.js, run this command in terminal:

rails webpacker:install
like image 119
Dipen Chauhan Avatar answered Oct 11 '22 14:10

Dipen Chauhan