From 1bdb26f21ba7bb26716711b4b091bb37ce884240 Mon Sep 17 00:00:00 2001 From: Ross Kaffenberger Date: Wed, 17 Feb 2021 20:06:55 -0500 Subject: [PATCH 1/3] Remove custom css webpack loader rules Webpacker 6 will provide loader rules by default when css webpack dependencies are detected. The custom loader rules were not set up correctly to work with the rest of the webpack config. Fixes @rails/webpacker issue #2916 --- config/webpack/custom.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/config/webpack/custom.js b/config/webpack/custom.js index 318a0ee..d9be305 100644 --- a/config/webpack/custom.js +++ b/config/webpack/custom.js @@ -6,20 +6,4 @@ module.exports = { ReactDOM: 'react-dom', } }, - module: { - rules: [ - { - test: /\.css$/i, - use: [ - "style-loader", - "css-loader" - ] - }, - { - test: /\.s[ac]ss$/i, - use: ["css-loader", "postcss-loader", { loader: "sass-loader", options: { implementation: require("sass") } }, - ], - }, - ], - } } From b217e69f157dc30f2cdac8bdbb3d7dbc088e1228 Mon Sep 17 00:00:00 2001 From: Ross Kaffenberger Date: Fri, 19 Feb 2021 12:00:04 -0500 Subject: [PATCH 2/3] Update webpacker gem version to match NPM package --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index ab92b6c..59f8eb8 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ gem 'pg', '~> 1.1' # Use Puma as the app server gem 'puma', '~> 5.0' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker -gem 'webpacker', '~> 6.0.0.beta.5' +gem 'webpacker', '6.0.0.beta.5' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder diff --git a/Gemfile.lock b/Gemfile.lock index 7886ca9..f3dadb9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,7 +71,7 @@ GEM ffi (1.14.2) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.8.8) + i18n (1.8.9) concurrent-ruby (~> 1.0) jbuilder (2.11.2) activesupport (>= 5.0.0) @@ -156,7 +156,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webpacker (6.0.0.pre.2) + webpacker (6.0.0.beta.5) activesupport (>= 5.2) rack-proxy (>= 0.6.1) railties (>= 5.2) @@ -182,7 +182,7 @@ DEPENDENCIES turbolinks (~> 5) tzinfo-data web-console (>= 4.1.0) - webpacker (~> 6.0.0.beta.5) + webpacker (= 6.0.0.beta.5) RUBY VERSION ruby 2.7.2p137 From 60c0970dc1a845a00579b9d91d4e0e9cc8654876 Mon Sep 17 00:00:00 2001 From: Ross Kaffenberger Date: Fri, 19 Feb 2021 12:10:29 -0500 Subject: [PATCH 3/3] Add webpacker config option for autorefresh --- config/webpacker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/webpacker.yml b/config/webpacker.yml index 8fec082..b5003cd 100644 --- a/config/webpacker.yml +++ b/config/webpacker.yml @@ -25,6 +25,8 @@ development: host: localhost port: 3035 public: localhost:3035 + # Inject browserside javascript that required by both HMR and Live(full) reload + inject_client: true # Hot Module Replacement updates modules while the application is running without a full reload hmr: false # Inline should be set to true if using HMR; it inserts a script to take care of live reloading