Git Product home page Git Product logo

Comments (3)

twiss avatar twiss commented on August 25, 2024 1

Yeah, we could do that indeed. import() is in fact a web standard, see dynamic imports. In the OpenPGP.js lightweight build, we preserve these imports as-is. In the full build, we include these dependencies indeed. Using webpack, it's possible to compile these dynamic imports to the script tag "hack", I believe.

from web-stream-tools.

twiss avatar twiss commented on August 25, 2024

Hey 👋 Yeah, I agree this is something we should do.

The main difficulty is around the way we load the streams polyfill "on demand" (i.e. only when it's not natively supported by the browser):

const [ponyfill, adapter] = await Promise.all([
import('web-streams-polyfill/ponyfill/es6'),
import('@mattiasbuelens/web-streams-adapter')
]);
which basically requires ES6, unless we add some workaround of inserting script tags or some such. However, the ES5 build could just unconditionally include the polyfill.

from web-stream-tools.

tomholub avatar tomholub commented on August 25, 2024

Thanks for the consideration.

It may be cleaner to offer several builds, like lean and full rather than a script tag hack. Regardless, I suppose your own OpenPGP.js builds will continue using the source / remain unaffected.

It's the first time I see this kind of import. That's not understandable by the browser anyway, is it? Rather, meant for the build tool? But if it's for the build tool, then that's long before it sees any browser, so that wouldn't be on-demand. I'm thoroughly confused :-)

from web-stream-tools.

Related Issues (8)

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.