Use Coffeescript with Next.js
This plugin uses
coffee-loader
.
For the moment, only the canary version of Next.js supports pages with different extensions. Until this feature is released into the stable version, do this:
npm install --save next@canary
or
yarn add next@canary
npm install --save next-coffeescript coffeescript
or
yarn add next-coffeescript coffeescript
Create a next.config.js
in your project
// next.config.js
const withCoffeescript = require('next-coffeescript')
module.exports = withCoffeescript()
Optionally you can add your custom Next.js configuration as parameter
// next.config.js
const withCoffeescript = require('next-coffeescript')
module.exports = withCoffeescript({
webpack(config, options) {
return config
},
coffeescriptLoaderOptions: {
literate: true
}
})