Nuxt/examples/coffeescript/modules/coffeescript.js

18 lines
521 B
JavaScript
Raw Normal View History

2018-03-16 16:12:06 +00:00
export default function () {
2018-01-05 08:43:35 +00:00
// Add .coffee extension for store, middleware and more
this.nuxt.options.build.additionalExtensions.push('coffee')
2018-01-05 08:43:35 +00:00
// Extend build
const coffeeLoader = {
test: /\.coffee$/,
loader: 'coffee-loader'
}
this.extendBuild((config) => {
2018-01-05 08:43:35 +00:00
// Add CoffeeScruot loader
config.module.rules.push(coffeeLoader)
// Add .coffee extension in webpack resolve
if (!config.resolve.extensions.includes('.coffee')) {
2018-01-05 08:43:35 +00:00
config.resolve.extensions.push('.coffee')
}
})
}