Skip to content

vue-coffee doesn’t build exports properly #165

@GeoffreyBooth

Description

@GeoffreyBooth

Steps to reproduce:

git clone git@github.com:Akryum/meteor-vue2-example.git # 71830c0
meteor npm install
meteor update # Updates to 1.4.4.1, akyrum package versions as of 2017-04-24

Edit App.vue to move Session.setDefault("counter", 0); into beforeCreate, per meteor-vue2-example#9:

export default {
  beforeCreate() {
    Session.setDefault("counter", 0);
  },
  data() {

Start up the app.

meteor

It works. Stop the app.

Edit App.vue again, and change the script block to this:

<script lang="coffee">
import Chat from './Chat.vue'
import Test from './Test.vue'

import {Session} from 'meteor/session'

labels = ['Click me!', 'Click me again!', 'Here! Click here!', 'Again! Again!',
'Don\'t click me! No, I\'m just kidding. You can.', 'You like that?',
'Can you stratch me in the back please?', 'You are soooo nice! Click!',
'Hmmmm...', 'You know, you are wasting time clicking me.',
'No really, you can click me as much as you want.', 'Click me to level up!'];

export default {
  beforeCreate: ->
    Session.setDefault 'counter', 0
    return

  data: ->
    {
      buttonLabel: 'Click me!'
      count: 0
      user: null
    }

  meteor:
    data:
      count: ->
        Session.get 'counter'
      user: ->
        Meteor.user()

  methods:
    addOne: ->
      Session.set 'counter', @count + 1
      @buttonLabel = labels[Math.round(Math.random() * (labels.length - 1))]
      return

  components:
    Chat: Chat
    Test: Test

  metaInfo:
    title: 'Meteor + Vue'
}
</script>

Add vue-coffee and start the app again:

meteor add akryum:vue-coffee # Adds 0.0.4
meteor

Observe a flood of errors in the browser console:

image

If you revert back to the JavaScript version of the script block, but just change export default to exports.default =, you get the same errors in the console.

What extra processing is happening to export default for JavaScript code blocks, that isn’t happening to CommonJS exports.default = code blocks as produced by vue-coffee?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions