You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempting to write a transformer that converts svg files to vue components does not appear to be working as expected
馃帥 Configuration/Setup
Following the documentation of Transformer and the svg-react plugin implementation, I am attempting to write a parcel transformer plugin that converts imported svg files to vue components:
馃 Expected Behavior
I had expected the following minimal implementation to be adequate (Full source):
Basically I was assuming that if I return an asset of type=vue where the svg is wrapped inside a template block, the default pipeline for vue3 sfc will take care of processing the generated component.
Now the dev server reports that everything has been built successfully but when I access the ui in browser, it fails to resolve the svg modules and I get a runtime error.
idex.b7a05eb9.js:61 Uncaught Error: Cannot find module 'vue:../../assets/icons/warning.svg'
at newRequire (index.b7a05eb9.js:61:19)
at newRequire (index.b7a05eb9.js:45:18)
at localRequire (index.b7a05eb9.js:84:35)
at 9LNAw.vue (fs-initializer.vue:46:1)
at newRequire (index.b7a05eb9.js:71:24)
at localRequire (index.b7a05eb9.js:84:35)
at initialize (fs-initializer.vue:4:12)
at 8nCLl.3e3393ff5748202f (fs-initializer.vue:12:1)
at newRequire (index.b7a05eb9.js:71:24)
at localRequire (index.b7a05eb9.js:84:35)
I am also convinced that this is not an issue with the transform itself - if I generate the vue component as a file as a separate step outside parcel and then import the generated file from my components - vue is able to handle it just fine and everything works.
馃實 Your Environment
Software
Version(s)
Parcel
2.9.3
Node
20.2.0
npm/Yarn
npm 9.6.6
Operating System
Ubuntu 23.04
The text was updated successfully, but these errors were encountered:
lorefnon
changed the title
Unable to create a svg transformer plugin for vue
Transformer plugin that generates vue component does not work
Oct 1, 2023
lorefnon
changed the title
Transformer plugin that generates vue component does not work
Transformer plugin that generates Vue SFC does not work
Oct 1, 2023
馃悰 bug report
Attempting to write a transformer that converts svg files to vue components does not appear to be working as expected
馃帥 Configuration/Setup
Following the documentation of Transformer and the svg-react plugin implementation, I am attempting to write a parcel transformer plugin that converts imported svg files to vue components:
馃 Expected Behavior
I had expected the following minimal implementation to be adequate (Full source):
Basically I was assuming that if I return an asset of type=vue where the svg is wrapped inside a template block, the default pipeline for vue3 sfc will take care of processing the generated component.
My .parcelrc is as follows:
馃槸 Current Behavior
This does not work. And I end up with errors saying that it is unable to find a transformer to further process the asset returned by my transformer.
If I also add vue transformer explicitly (which I don't see why would be needed):
Now the dev server reports that everything has been built successfully but when I access the ui in browser, it fails to resolve the svg modules and I get a runtime error.
I am also convinced that this is not an issue with the transform itself - if I generate the vue component as a file as a separate step outside parcel and then import the generated file from my components - vue is able to handle it just fine and everything works.
馃實 Your Environment
The text was updated successfully, but these errors were encountered: