I created a brand new Rails app with Ruby 2.7.2 and Ruby on Rails 6.1.3:
rails new rails6
Then I installed the CoffeeScript compiler using the Rails command:
rails webpacker:install:coffee
But when i started the webpack-dev-server, he was unable to compile correctly:
Asset Size Chunks Chunk Names
js/application-30c16ea0138c526e20f5.js 515 KiB application [emitted] [immutable] application
js/application-30c16ea0138c526e20f5.js.map 579 KiB application [emitted] [dev] application
js/hello_coffee-5eba0c58c2666f949e88.js 395 KiB hello_coffee [emitted] [immutable] hello_coffee
js/hello_coffee-5eba0c58c2666f949e88.js.map 444 KiB hello_coffee [emitted] [dev] hello_coffee
manifest.json 710 bytes [emitted]
ERROR in ./app/javascript/packs/hello_coffee.coffee
Module build failed (from ./node_modules/coffee-loader/dist/cjs.js):
TypeError: this.getOptions is not a function
at Object.loader (/Users/iwan/dev/rails/rails6/node_modules/coffee-loader/dist/index.js:21:24)
ℹ 「wdm」: Failed to compile.
How to fix this issue?