Morgul / snowpack-plugin-vue2

A snowpack vue2 compiler that reuses `@snowpack/plugin-vue` verbatim.
MIT License
6 stars 2 forks source link

Scoped style not supported #2

Closed eytienne closed 3 years ago

eytienne commented 3 years ago

Hi @Morgul

Your clean approach described in the README looks nice. I felt on your plugin trying to use snowpack and avoid webpack slowness in our devs.

So I did notice that <style scoped> is not working. It seems to come from a wider problem which is not reflected in your paragraph: https://github.com/Morgul/snowpack-plugin-vue2#vue-library-choice. That problem is that @vue/compiler-sfc does things that were not backported with @vue/component-compiler-utils, its Vue 2 false equivalent. They are similarities between SFCTemplateCompileOptions (1) and TemplateCompileOptions (2) but the scoped style feature lacks.

With webpack it worked because vue-loader precisely fulfills those discrepancies. I am not even sure that requesting you this feature (roughly to copy vue-loader work (3)) is the best solution. Shouldn't this have been done directly within @vue/component-compiler-utils?

  1. https://github.com/vuejs/vue-next/blob/master/packages/compiler-sfc/src/compileTemplate.ts#L43
  2. https://github.com/vuejs/component-compiler-utils#compiletemplatetemplatecompileoptions-templatecompileresults
  3. https://github.com/vuejs/vue-loader/blob/master/lib/index.js#L163