nguyenvanduocit / vue-loading-spinner

Just another collection of loading spinners with Vue.js, alot of spinners
https://nguyenvanduocit.github.io/vue-loading-spinner/
687 stars 106 forks source link

Parse error on 'import' when used within a component-based project #11

Closed MellowCobra closed 1 year ago

MellowCobra commented 7 years ago

Getting the following error when attempting to use in a component-based project with a Vueify build process:

/path/to/project/node_modules/vue-loading-spinner/src/index.js:1
import Circle from './components/Circle.vue'
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'

Imported in my project's main.js like so:

import {Hexagon} from 'vue-loading-spinner'
Vue.component('hexagon-loading-spinner', Hexagon)
MellowCobra commented 7 years ago

I believe this to be a problem with the way the project is importing vue components into the index.js file, which doesn't work with the vueify build process, as described by @LinusBorg in this issue.

jverce commented 6 years ago

@MellowCobra were you able to troubleshoot this?

gabel commented 6 years ago

@jverce The only way to workaround for me was to use the spinner direct from the component.

Example:

  import Plane from 'vue-loading-spinner/src/components/Plane.vue'
MellowCobra commented 6 years ago

I didn't continue troubleshooting much after this, but it seems like @gabel's solution could be a good workaround.