butaneprotocol / translucent-compat

Deprecated in favour of blaze https://github.com/butaneprotocol/blaze-cardano
https://github.com/butaneprotocol/blaze-cardano
Other
15 stars 8 forks source link

Browser compatibility #9

Open micahkendall opened 6 months ago

micahkendall commented 6 months ago

Currently I use translucent in browser environment via a messy polyfill. See below:

resolve: {
        alias: {
            'node-fetch': 'node-fetch-polyfill',
            'sha256': 'tiny-sha256',
            '@sinclair/typebox': '@sinclair/typebox',
            '@dcspark/cardano-multiplatform-lib-nodejs': '@dcspark/cardano-multiplatform-lib-browser',
            'uplc-node': 'translucent/uplc/pkg-web',
            '@emurgo/cardano-message-signing-nodejs': '@emurgo/cardano-message-signing-browser',
        }
    },
optimizeDeps: {
        exclude: ['translucent', 'typebox'],
    ...
    },

We should improve this to make browser integration simpler but I'm not enough of a package managing whiz to know how exactly.

iburzynski commented 2 months ago

I tried using this polyfill with Vite but when I run the dev server I get a ton of "Could not read from file" errors