Giter Site home page Giter Site logo

Comments (6)

hrynko avatar hrynko commented on July 20, 2024

Hi @jopicornell,

Thank you for providing the Stackblitz project. Now I see the issue and I see that it is not in Vite, but in Vite+Ionic. Also the explanation in the Ionic repo looks relevant, will try to figure it out.

from vue-pdf-embed.

jopicornell avatar jopicornell commented on July 20, 2024

Hi @hrynko !

Have you found something relevant to fix this issue? I can help you if necessary, but I can't find the real problem. I'll give it another look in case I feel inspired and find it.

from vue-pdf-embed.

hrynko avatar hrynko commented on July 20, 2024

Honestly, I'm too busy with other projects right now and haven't had enough time to dive into this issue. But the discussion from the Ionic repo looks very much like this case. The main point there is having 2 instances of Vue because of require('vue') in the bundle. I assume this can be solved by adjusting the Webpack config (see externals).

I would appreciate if you could try to fix this. For testing purposes you can fork the vue-pdf-emded repo and install into your project via Git or clone it and install locally (npm i file:<PROJECT_LOCATION>). Please let me know if you need any help. Thanks!

from vue-pdf-embed.

jopicornell avatar jopicornell commented on July 20, 2024

Hello,

Thank you for your reply. I've been doing some tests, and I've come to a dead end. In webpack.config.js there's a externals: { vue: 'vue' } , which should be enough. The problem is that vue-loader v16 seems to ignore that and is using require('vue') in the compilated file. I've tried to update vue-loader to v17 for Vue 3, but seems like they have a problem in their compilated code and it throws an error ( Cannot find module 'vue/compiler-sfc'), which no one seems to know how to solve it.

I'm sensing that Vue community/devs is focusing on vite and are abandoning their webpack build tools. I suggest compiling the project with Vite, but that will bring other issues for sure. Let me know if you have any idea on how to face this issue. I can investigate further, but my knowledge of compiling libraries is rather limited.

from vue-pdf-embed.

hrynko avatar hrynko commented on July 20, 2024

Hi @jopicornell,

I had another attempt to fix this (based on your suggestions), but no success yet. Migration to Vite might make sense, but support for Vue 2 would then be lost.

Also, I haven't been able to find any successful cases of solving this problem in other libraries, so unfortunately I will have to put this issue on hold for now.

from vue-pdf-embed.

hrynko avatar hrynko commented on July 20, 2024

Resolved in v2.0.0 after switching to Vite

from vue-pdf-embed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.