Giter Site home page Giter Site logo

Comments (5)

favna avatar favna commented on May 29, 2024

I'm not sure where you draw the conclusion from that node_compat is discouraged? The docs don't mention any such thing: https://developers.cloudflare.com/workers/runtime-apis/nodejs

from shapeshift.

SuperchupuDev avatar SuperchupuDev commented on May 29, 2024

@favna the wrangler CLI mentions that node_compat has serious tradeoffs
image

also the plugin it uses is unmaintained

from shapeshift.

favna avatar favna commented on May 29, 2024

Regarding Wrangler using code from ionic, you'll have to take that up with Cloudflare. As for the usage of node:util in this lib, we are very much aware of the issue, but at the same time personally, I have no idea how we can replace it. Possibly @kyranet who designed that part of the code can toss in some ideas. Alternatively, I'm not entirely sure why using @imranbarbhuiya's esbuild-plugins-node-modules-polyfill does not replace var util = require('util'); / import { inspect } from 'util'; from the CJS and ESM builds respectively when the plugin is activated for those bundles. That might be a way to achieve wrangler support as well.

That all said, I'm not sure if just replacing util is enough, because we also depend on:

import get from 'lodash/get.js';
import fastDeepEqual from 'fast-deep-equal/es6/index.js';
import uniqWith from 'lodash/uniqWith.js';

And outside of bundling all the code into the shapeshift bundle I don't see any way to replace those.

from shapeshift.

imranbarbhuiya avatar imranbarbhuiya commented on May 29, 2024

wrangler is also planning to use this plugin, maybe it'll solve the issue. see cloudflare/workers-sdk#3832 but they want to ship it as a breaking change so I am not sure if it'll happen anytime soon

from shapeshift.

imranbarbhuiya avatar imranbarbhuiya commented on May 29, 2024

Alternatively, I'm not entirely sure why using @imranbarbhuiya's esbuild-plugins-node-modules-polyfill does not replace var util = require('util'); / import { inspect } from 'util'; from the CJS and ESM builds respectively when the plugin is activated for those bundles.

We only enabled it for browser environments as node already have it. We can still make it to bundle for node env too

from shapeshift.

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.