Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

@spacedawwwg spacedawwwg commented Dec 7, 2020

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 join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.