Configure CoffeeScript compilation with Webpacker

This commit is contained in:
Andreas Nedbal 2020-12-25 03:31:46 +01:00 committed by Andreas Nedbal
parent 388d34c9ce
commit df664d2772
3 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,5 @@
const { environment } = require('@rails/webpacker')
const coffee = require('./loaders/coffee')
environment.loaders.prepend('coffee', coffee)
module.exports = environment

View File

@ -0,0 +1,12 @@
module.exports = {
test: /\.coffee(\.erb)?$/,
use: [{
loader: 'coffee-loader',
options: {
bare: false,
transpile: {
presets: ['@babel/preset-env'],
},
}
}]
}

View File

@ -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