vuejs / vueify

Browserify transform for single-file Vue components
MIT License
1.17k stars 152 forks source link

"exports default" versus "module.exports" in .vue files #157

Open sombriks opened 7 years ago

sombriks commented 7 years ago

Hello all,

i've made a really small and simple vueify sample however there is making me confuse, as can be seen there.

all the sampe .vue files around uses exports default, but when i tried them on my sample project i got this error:

Parsing file /home/sombriks/git/simple-vueify-setup/app.vue: Unexpected token (15:8)

however if i change the very begining line of this .vue file from:

exports default {

to

module.exports = {

it will work nicely. As expected.

what could be happening there?

is there any missing step in order to get it 100% paired with the rest of .vue files?

my main concern if, for example, i import a few 3rd party components which uses exports default and my vueify-flavoured code gets unable do use those components.

danieldiekmeier commented 7 years ago

I think the problem is that browserify currently doesn't support the new ES6 import/export syntax. If you add babel to the build step, babel will transform the imports/exports so that browserify can understand them.

See this part of the README: https://github.com/vuejs/vueify#es2015-with-babel

Hope this helps.