Giter VIP home page Giter VIP logo

Comments (6)

alizain avatar alizain commented on August 16, 2024

@WorldMaker thank you for your kind response. I was actually thinking about the same, and was going to look into it later this week, however since you're experiencing breakages, I will try to push a fix as soon as possible!

from javascript.

WorldMaker avatar WorldMaker commented on August 16, 2024

Luckily in this case it was a build server canary warning that I can ignore for now. :) (The real lesson for me right now is that the build server is currently ignoring package-lock.json.) I've been using Typescript for a long while now, so feel free to reach out if you want a hand.

from javascript.

alizain avatar alizain commented on August 16, 2024

Phew! So I just pushed out the release with the fixes. The downside is that I had to remove global browser support. Any thoughts on non-hacky ways to support that functionality?

from javascript.

WorldMaker avatar WorldMaker commented on August 16, 2024

My first thought is to just drop global browser support, it seems better these days to encourage fellow developers to use a module system, then to let them continue to avoid them in 2017.

That said, I've seen a few options. The obvious and it will feel like a hack is just to always set the global: ;(window || global || {} as any).ulid = factory(prng).

A growing pattern is to output only/primarily ES2015 modules, use @std/esm to support the CommonJS-only versions of NodeJS, and use rollup (or babel or webpack, but for libraries it seems like rollup is the most common choice and easiest to configure to this particular library need) to build a dist JS file with a global export build from the ES2015 modules. (That just leaves AMD users out in the cold, which is possibly fine in 2017, but Typescript's --outfile support for a concatenated single file AMD dist JS file works pretty well there; you could have a default tsconfig.json for ES2015 modules and a secondary tsconfig.amd.json for AMD output.)

from javascript.

alizain avatar alizain commented on August 16, 2024

So I used parts of your advise. I'm using tsc to create the ES6+ compatible file, and the typings file. Then I use rollup to output ES+ compatible file which works with CommonJS, AMD, and the browser. Let me know if you have any trouble with it!

from javascript.

WorldMaker avatar WorldMaker commented on August 16, 2024

Looks good to me. Thanks.

from javascript.

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.