Giter VIP home page Giter VIP logo

Comments (6)

TheAsda avatar TheAsda commented on August 17, 2024

So i did some tesing with import and require.
Branch with import-in-the-middle: https://github.com/TheAsda/import-in-the-middle-issue/tree/master
Branch with require-in-the-middle: https://github.com/TheAsda/import-in-the-middle-issue/tree/require
There are two scripts that apply some patching to fastify package. With require everything works as expected:
image
But the same example with import applies only the latest patch:
image
I also tried different methods such as using register from the module package, applying patches in single file. The result is the same

from import-in-the-middle.

TheAsda avatar TheAsda commented on August 17, 2024

Looks like the issue is with proxy created in https://github.com/DataDog/import-in-the-middle/blob/main/lib/register.js. hook is called with the scoped namespace that is the same every time the hook is called

from import-in-the-middle.

TheAsda avatar TheAsda commented on August 17, 2024

So the issue is that in register only setter is used so every time hook is called with the original namespace

from import-in-the-middle.

TheAsda avatar TheAsda commented on August 17, 2024

I added getter similar to setter to be able to get the latest namespace after modification
image

from import-in-the-middle.

timfish avatar timfish commented on August 17, 2024

I added getter similar to setter to be able to get the latest namespace after modification

Could you submit a PR to fix this or do you have a patch I could try?

from import-in-the-middle.

TheAsda avatar TheAsda commented on August 17, 2024

I managed to fix the issue with default import patching but when i tested patching named exports tests failed :( Right now i don't have a solution to this problem

from import-in-the-middle.

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.