Nuxt/examples/coffeescript/modules/coffeescript.js

18 lines
510 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.extensions.push('coffee')
// 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.indexOf('.coffee') === -1) {
config.resolve.extensions.push('.coffee')
}
})
}