Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

yuhliel's avatar

How to make Web Component work in Laravel/Vue framework?

Hello! I've been trying to make work file-viewer. I've already registered the package in app.js But I can't even make the example work. Any idea? I am missing something? Or if you know a better/similar package, would really appreciate it.

    <file-viewer
        id="file-viewer"
        filename="sample.pdf"
        url="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    ></file-viewer>

Link to the package => https://www.npmjs.com/package/file-viewer

0 likes
4 replies
automica's avatar

@yuhliel can you show how you’ve registered your package?

Usually I would expect to see any errors if package isn’t playing properly in the terminal when I am recompiling my js. If you install Vue developer tools for your browser then this should also give you an idea of what is going on.

1 like
yuhliel's avatar

Hi! Thank you for taking the time to read my question.

I am just doing a basic import on app.js and added polyfills to support older browsers.

import  'file-viewer';

and on the html

<script src="webcomponents/webcomponents-loader.js"></script>

No error at the moment of running the watcher, neither in the console.

sahil1711's avatar

I am currently stuck on a similar problem , would appreciate assistance thanks.

martinbean's avatar

@sahil1711 Then create your own thread with your own question, instead of bumping a three year old one.

Please or to participate in this conversation.