vuejs/rollup-plugin-vue

customBlocks src attribute

spacedawwwg opened this issue · 0 comments

Version

5.0.0

Reproduction link

https://codesandbox.io/s/crazy-engelbart-c3bw0?file=/src/components/HelloWorld.vue

Steps to reproduce

add custom block to vue sfc with a src attribute. e.g:

configure rollup-plugin vue to include 'my-thing' custom block

vue({
      customBlocks: ['my-thing']
    }),

add transform to rollup to handle custom block, e.g

function myThing() {
  const filter = createFilter([/my-thing/]);

  return {
    transform(code, id) {
      if (filter(id)) {
          return {
            code: `
                export default function (Component) {
                    Component.options.__my_thing = ${JSON.stringify(code)};
                }
            `,
            map: null,
          },
      };
   }
}

What is expected?

when using the transform, I'd expect to be able to access the 'src' attribute either as a path or from the code prop.

What is actually happening?

'code' is undefined and src isn't available as a path