Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

customBlocks src attribute #420

Open
spacedawwwg opened this issue Dec 7, 2020 · 0 comments
Open

customBlocks src attribute #420

spacedawwwg opened this issue Dec 7, 2020 · 0 comments

Comments

@spacedawwwg
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant