vuejs / rollup-plugin-vue

Roll .vue files
https://vuejs.github.io/rollup-plugin-vue
MIT License
843 stars 148 forks source link

Can we process generated string? #434

Closed alexpopovme closed 3 years ago

alexpopovme commented 3 years ago

What problem does this feature solve?

I'm generating a vue file contents and use @rollup/plugin-virtual on the build process, but it seems rollup-plugin-vue only can read an input file and doesn't accept code as input. I'm reqired to not to save the vue file on the build process.

I tried to use @vue/compiler-sfc to pre-compile the generated vue code and do not use the plugin, but the resulting render function differs from the render function after processing with the plugin the real vue file with the same code.

Are there any variants for my case?

What does the proposed API look like?

const vue = require('rollup-plugin-vue')

vue({
  source: `// contents same as in a vue file`
})