Configure CoffeeScript compilation with Webpacker
This commit is contained in:
parent
388d34c9ce
commit
df664d2772
|
@ -1,3 +1,5 @@
|
||||||
const { environment } = require('@rails/webpacker')
|
const { environment } = require('@rails/webpacker')
|
||||||
|
const coffee = require('./loaders/coffee')
|
||||||
|
|
||||||
|
environment.loaders.prepend('coffee', coffee)
|
||||||
module.exports = environment
|
module.exports = environment
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
module.exports = {
|
||||||
|
test: /\.coffee(\.erb)?$/,
|
||||||
|
use: [{
|
||||||
|
loader: 'coffee-loader',
|
||||||
|
options: {
|
||||||
|
bare: false,
|
||||||
|
transpile: {
|
||||||
|
presets: ['@babel/preset-env'],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
|
@ -10,7 +10,7 @@ default: &default
|
||||||
|
|
||||||
# Additional paths webpack should lookup modules
|
# Additional paths webpack should lookup modules
|
||||||
# ['app/assets', 'engine/foo/app/assets']
|
# ['app/assets', 'engine/foo/app/assets']
|
||||||
additional_paths: []
|
resolved_paths: []
|
||||||
|
|
||||||
# Reload manifest.json on all requests so we reload latest compiled packs
|
# Reload manifest.json on all requests so we reload latest compiled packs
|
||||||
cache_manifest: false
|
cache_manifest: false
|
||||||
|
@ -33,6 +33,7 @@ default: &default
|
||||||
- .woff2
|
- .woff2
|
||||||
|
|
||||||
extensions:
|
extensions:
|
||||||
|
- .coffee
|
||||||
- .mjs
|
- .mjs
|
||||||
- .js
|
- .js
|
||||||
- .sass
|
- .sass
|
||||||
|
@ -89,4 +90,4 @@ production:
|
||||||
extract_css: true
|
extract_css: true
|
||||||
|
|
||||||
# Cache manifest.json for performance
|
# Cache manifest.json for performance
|
||||||
cache_manifest: true
|
cache_manifest: true
|
Loading…
Reference in New Issue