Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParseError: Unexpected token when trying to import #2

Closed
nivv opened this issue Feb 21, 2016 · 5 comments
Closed

ParseError: Unexpected token when trying to import #2

nivv opened this issue Feb 21, 2016 · 5 comments

Comments

@nivv
Copy link

nivv commented Feb 21, 2016

I'm getting the below error when trying to import any of the loaders. I've tried to create my own components with the same contents and that works fine.

import PulseLoader from 'vue-spinner/src/PulseLoader.vue'
[12:38:54] gulp-notify: [Laravel Elixir] Browserify Failed!: Unexpected token

/Users/user/projects/vue-project/node_modules/vue-spinner/src/PulseLoader.vue:1
<template>
^
ParseError: Unexpected token
@greyby
Copy link
Owner

greyby commented Feb 23, 2016

Can you provide the code?

@nivv
Copy link
Author

nivv commented Feb 24, 2016

Main.js (using browserify/vueify)

var Vue = require('vue');
Vue.use(require('vue-resource'));

import PulseLoader from 'vue-spinner/src/PulseLoader.vue';


new Vue({
    el: '#app',

    components: {
        PulseLoader
    }
});

If I copy the contents from PulseLoader.vue to my own component dir it loads fine. I'm guessing there's some problem with my build tool chain.

@greyby
Copy link
Owner

greyby commented Feb 24, 2016

Please turn on vue debugging mode to see the error log. Vue.config.debug = true

@cyberdummy
Copy link

Its because browserify will not pass included files from the node_modules folder to its transformers (vueify).

import { PulseLoader } from 'vue-spinner/dist/vue-spinner.min';

As an import line should work.

var PulseLoader= require('vue-spinner/dist/vue-spinner.min').PulseLoader;

If you want to use CommonJS.

@greyby
Copy link
Owner

greyby commented Feb 28, 2016

Thank you @cyberdummy . I had update the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants