vue-icon icon indicating copy to clipboard operation
vue-icon copied to clipboard

Nuxt: SyntaxError Unexpected token <

Open fsproru opened this issue 5 years ago • 2 comments

When I import SvgIcon and add it as a component, I start getting Unexpected token < on page refresh in a Nuxt project.

Sample code

import SvgIcon from '@jamescoyle/vue-icon'
import { Component } from 'vue-property-decorator'

@Component({
  components: {
    SvgIcon
  }
})
export default class MyComponent extends Vue {
}

fsproru avatar Nov 22 '20 07:11 fsproru

I'm guessing it's not being treated in the same way as a direct import and is expecting a JS Module instead of a Vue SFC. I'll look into solutions to this but I'm assuming I would need a build step to compile the SFC to a Module.

For now you can just import the component directly using import SvgIcon from '@jamescoyle/vue-icon/lib/svg-icon.vue'.

JamesCoyle avatar Nov 22 '20 13:11 JamesCoyle

There is missing value variable in flip validator

flip: {
    type: String,
    validator: () => ["horizontal", "vertical", "both"].includes(value),
},

👉 https://github.com/JamesCoyle/vue-icon/blob/51550e9d1a8f87b5026e429335ba3e0eee8c2e08/lib/svg-icon.vue#L39

Correction:

flip: {
    type: String,
    validator: (value) => ["horizontal", "vertical", "both"].includes(value),
},

abdoulmouctard avatar Dec 24 '20 15:12 abdoulmouctard