damianstasik / vue-svg-loader

🔨 webpack loader that lets you use SVG files as Vue components
https://vue-svg-loader.js.org
MIT License
645 stars 86 forks source link

Problem after updating to 0.16.0 #108

Closed funder7 closed 4 years ago

funder7 commented 4 years ago

Hello, I'm sorry if my report is not complete but I'm a bit out of time now.

Today I did upgrade all outdated libraries in my project, including vue-svg-loader (from 0.15.0 to 0.16.0). After the update, the build completed with a warning for each one of the vue components generated by the loader, here is the webpack output for one of them:

WARNING in ./src/frontend/components/Medal.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--2-0!./node_modules/vuetify-loader/lib/loader.js??ref--13
-0!./node_modules/vue-loader/lib??vue-loader-options!./src/frontend/components/Medal.vue?vue&type=script&lang=js&) 13:12-18
"export 'default' (imported as 'Medal1') was not found in '@Components/medal_icons/medal-1.svg'

Even if this is only a warning, when I load my vue application, then I receive this message in the console:

TypeError: "exports" is read-only

I wasn't sure if that was releated to vue-svg-loader or other libraries update (or both).

Anyway, after downgrading to previous version, warnings disappeared and the application loaded correctly.

Thanks for this library ;)

simllll commented 4 years ago

Maybe related to https://github.com/visualfanatic/svg-to-vue/issues/19

funder7 commented 4 years ago

Yes, I can confirm that: downgrading svg-to-vue from 0.7.0 to 0.6.0 resolved all warnings, and made the application work again.

I missed some posts, sorry :)

jcushman commented 4 years ago

Maybe this should be re-opened? I think I just got the same error.

During compilation:

WARNING  Compiled with 1 warnings                                                                                                                                                                                                               7:00:10 PM

 warning  in ./static/js/cite-grid/main.vue?vue&type=script&lang=js&

"export 'default' (imported as 'USMap') was not found in '../../../capweb/templates/includes/usa_territories_white.svg'

During page display:

usa_territories_white.svg?376f:2 Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
    at Module.eval (usa_territories_white.svg?376f:2)
    at eval (usa_territories_white.svg:620)
    at Module../capweb/templates/includes/usa_territories_white.svg (cite-grid.js:4868)
    at __webpack_require__ (cite-grid.js:782)
    at fn (cite-grid.js:150)
    at eval (cjs.js?!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js?!../node_modules/vue-loader/lib/index.js?!./static/js/cite-grid/main.vue?vue&type=script&lang=js&:18)
    at Module.../node_modules/cache-loader/dist/cjs.js?!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js?!../node_modules/vue-loader/lib/index.js?!./static/js/cite-grid/main.vue?vue&type=script&lang=js& (cite-grid.js:4418)
    at __webpack_require__ (cite-grid.js:782)
    at fn (cite-grid.js:150)
    at eval (main.vue?8074:1)

As a workaround, forcing yarn to use an earlier version of svg-to-vue avoided the issue:

  "resolutions": {
    "vue-svg-loader/svg-to-vue": "0.6.0"
  },