Giter Site home page Giter Site logo

Comments (9)

JayaKrishnaNamburu avatar JayaKrishnaNamburu commented on June 19, 2024 1

Hi @soulsam480 thanks for the follow-up on this. Highly appreciate it 😄

from vite-plugin-jspm.

JayaKrishnaNamburu avatar JayaKrishnaNamburu commented on June 19, 2024 1

Hi @soulsam480 thanks for looking into this again. We can actually re-write the whole plugin. I was actually hopping to do it once. Here is a very simple implementation for the same with a rollup-plugin
https://github.com/jspm/jspm-cli/blob/main/src/build/rollup-importmap-plugin.ts

The downloadDeps can just fetch the module and return the value and return to the build in load step. Or it can just mark it as external and then we can inject the import-map into the index.html file.

from vite-plugin-jspm.

JayaKrishnaNamburu avatar JayaKrishnaNamburu commented on June 19, 2024

Hello, can you try the latest 0.5 version of the plugin please. And feel free to share a repo if it still happens

from vite-plugin-jspm.

soulsam480 avatar soulsam480 commented on June 19, 2024

seeing the same issue too after bundling. After running vite build or 'vite dev' it still bundles the entire library instead of loading it from CDN. I see an empty import map in the bundled html file. Here is a repro URL. I'm on

from vite-plugin-jspm.

soulsam480 avatar soulsam480 commented on June 19, 2024

I found out that in my case this only happens when the dependency in package.json. when it's there, this plugin doesn't generate a import map and vite bundles the app by taking the dependency from node_modules. as soon as I remove it, it works. is there any way to make the plugin force generate an import map even if the dependency is there in package.json ? or some form of include/exclude list ?

from vite-plugin-jspm.

JayaKrishnaNamburu avatar JayaKrishnaNamburu commented on June 19, 2024

Looks like vite might be resolving the deps from the node_modules before hitting the plugin. We should look into the use-case. So, the plugin get's resolved all the time even when deps are installed.

from vite-plugin-jspm.

soulsam480 avatar soulsam480 commented on June 19, 2024

I don't have much idea about vite plugins, but I think plugin ordering can help https://github.com/jspm/vite-plugin-jspm/blob/main/plugin/src/index.ts#L180 https://vitejs.dev/guide/using-plugins.html#enforcing-plugin-ordering

I've started a thread in vite help channel of discord and linked this issue. https://discord.com/channels/804011606160703521/1174703054101168219/1174703054101168219 if you're there on discord please check it out. thank you for initiative

from vite-plugin-jspm.

soulsam480 avatar soulsam480 commented on June 19, 2024

I think we can do something like this, I'll try to make it work this weekend https://github.com/MilanKovacic/vite-plugin-externalize-dependencies/blob/main/src/index.ts

from vite-plugin-jspm.

soulsam480 avatar soulsam480 commented on June 19, 2024

hey @JayaKrishnaNamburu , I made it work without the downloadDeps option soulsam480@71023ee#diff-8a5fbf50d373626ae826a0917ccac02a9a838e8dc7dc7f4cc34ea2fc00402219. I don't fully understand how downloadDeps is handled. if you can kindly point me to a doc explaining how the plugin is architected currently that'd be a great help.

Also the reason why it didn't work earlier is the deps were marked external in the post resolveId phase, which won't have any effect on deps externalization as vite has already built the app. also the tests couldn't catch it as it doesn't have a package.json. I've added a playground package which can be used to test it out.

from vite-plugin-jspm.

Related Issues (4)

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.