I'm getting a parse error when attempting to use coffee-loader
as outlined here:
https://nuxtjs.org/faq/pre-processors/#how-to-use-pre-processors-
I'm using a recent-ish node+npm, is there something else I need to do (a config file, maybe...?) in order to get coffeescript working inside .vue
files?
$ nvm use 7
Now using node v7.10.0 (npm v4.2.0)
$ vue init nuxt/starter coffee-test
$ cd coffee-test
$ npm install
$ npm install --save-dev pug@2.0.0-beta6 pug-loader coffee-script coffee-loader node-sass sass-loader
$ vim pages/index.vue # modify `<script>`, see content below in error trace
$ npm run build
> coffee-test@1.0.0 build /private/tmp/coffee-test
> nuxt build
[nuxt] Building...
nuxt:build App root: /private/tmp/coffee-test +0ms
nuxt:build Generating /private/tmp/coffee-test/.nuxt files... +1ms
nuxt:build Generating files... +6ms
nuxt:build Generating routes... +5ms
nuxt:build Building files... +15ms
Build completed in 7.526s
[nuxt:build:client]
Hash: cb5f2fae7007639d95af
Version: webpack 2.6.1
Time: 7531ms
Asset Size Chunks Chunk Names
0.nuxt.bundle.18326821bb0f9ece41a2.js 8.01 kB 0 [emitted] pages/index
1.nuxt.bundle.a137ddf7cda7d661e52b.js 2.78 kB 1 [emitted] layouts/default
vendor.bundle.262d580d57297eb711d1.js 135 kB 2 [emitted] vendor
nuxt.bundle.e795fc9f10e9fa381fea.js 23.9 kB 3 [emitted] app
manifest.cb5f2fae7007639d95af.js 1.51 kB 4 [emitted] manifest
index.html 132 bytes [emitted]
client-manifest.json 5.57 kB [emitted]
ERROR in ./pages/index.vue
/private/tmp/coffee-test/pages/index.vue
23:13 error Parsing error: Unexpected token, expected ;
3 |
4 | module.exports =
> 5 | components: { Logo }
| ^
6 | /* HTML */
7 |
✖ 1 problem (1 error, 0 warnings)
@ ./.nuxt/router.js 9:9-97
@ ./.nuxt/index.js
@ ./.nuxt/client.js
Error: Webpack build exited with errors
at /private/tmp/coffee-test/node_modules/nuxt/dist/nuxt.js:1170:46
Just to confirm the exact contents of the <script>
block:
$ grep -A5 '<script' pages/index.vue
<script lang="coffee">
import Logo from '~components/Logo.vue'
module.exports =
components: { Logo }
</script>
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c790">#c790</a>)</em></sub></div>