Skip to content

Can not work with CoffeeScript #118

Closed
@JasinYip

Description

@JasinYip

I'm trying to use Vue with CoffeeScript. But I got a problem when I trying to build it.

webpack.config.js

module.exports = {
    entry: './main.js',
    output: {
        path: './build',
        filename: 'app.js'
    },
    module: {
        loaders: [
            { test: /\.vue$/, loader: 'vue' },
            { test: /\.coffee$/, loader: 'coffee' }    
        ]
    }
}

main.js

Vue = require('vue');
App = require('./app.vue');

new Vue({
    el: 'body',
    components: {
        App: App
    }
})

app.vue

<template>
  <h1>Hello World</h1>
</template>

<script lang="coffee">
  console.log 1
</script>

And the terminal said:

Hash: 89092de5042216f6d1ea
Version: webpack 1.12.2
Time: 870ms
 Asset    Size  Chunks             Chunk Names
app.js  247 kB       0  [emitted]  main
   [0] ./main.js 121 bytes {0} [built]
    + 5 hidden modules

ERROR in ./~/coffee-loader!./~/vue-loader/lib/selector.js?type=script&index=0!./app.vue
Module build failed: Error: /Users/jasinyip/prj/test/vue-coffee/node_modules/vue-loader/lib/selector.js?type=script&index=0!/Users/jasinyip/prj/test/vue-coffee/app.vue:9:2: error: regular expressions cannot begin with *
/* generated by vue-loader */
 ^
    L8: /* generated by vue-loader */
          ^

  at Object.module.exports (/Users/jasinyip/prj/test/vue-coffee/node_modules/coffee-loader/index.js:37:9)
 @ ./app.vue 2:17-108

Version:
coffee-loader: 0.7.2
vue-loader: 7.5.1

How could I fix it? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions