diff --git a/config/webpack/environment.js b/config/webpack/environment.js index d16d9af7..89edc45f 100644 --- a/config/webpack/environment.js +++ b/config/webpack/environment.js @@ -1,3 +1,5 @@ const { environment } = require('@rails/webpacker') +const coffee = require('./loaders/coffee') +environment.loaders.prepend('coffee', coffee) module.exports = environment diff --git a/config/webpack/loaders/coffee.js b/config/webpack/loaders/coffee.js new file mode 100644 index 00000000..77a7b891 --- /dev/null +++ b/config/webpack/loaders/coffee.js @@ -0,0 +1,12 @@ +module.exports = { + test: /\.coffee(\.erb)?$/, + use: [{ + loader: 'coffee-loader', + options: { + bare: false, + transpile: { + presets: ['@babel/preset-env'], + }, + } + }] +} diff --git a/config/webpacker.yml b/config/webpacker.yml index a6b14656..e978dba1 100644 --- a/config/webpacker.yml +++ b/config/webpacker.yml @@ -10,7 +10,7 @@ default: &default # Additional paths webpack should lookup modules # ['app/assets', 'engine/foo/app/assets'] - additional_paths: [] + resolved_paths: [] # Reload manifest.json on all requests so we reload latest compiled packs cache_manifest: false @@ -33,6 +33,7 @@ default: &default - .woff2 extensions: + - .coffee - .mjs - .js - .sass @@ -89,4 +90,4 @@ production: extract_css: true # Cache manifest.json for performance - cache_manifest: true + cache_manifest: true \ No newline at end of file