Comments (6)
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:
But the same example with import applies only the latest patch:
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.
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.
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.
I added getter
similar to setter
to be able to get the latest namespace after modification
from import-in-the-middle.
I added
getter
similar tosetter
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.
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)
- Use `es-module-lexer` to parse ESM
- Doesn't handle exports with invalid identifiers
- `getFullCjsExports` does not resolve re-exports from external dependencies
- IITM Throws Error When an NPM Package is Not Installed in the Root Folder HOT 7
- parentResolve is not a function HOT 1
- Should fail gracefully when exports cannot be parsed
- Explicitly named exports should be exported over `export *` exports HOT 3
- Acorn parser does not support import attributes
- SyntaxError on importing some packages when using register() HOT 14
- SyntaxError when importing a JSON file using { type: 'json' } HOT 3
- import-in-the-middle' failed to wrap 'file:///app/node_modules/@prisma/client/default.js' HOT 2
- iitm wrappers copy exported primitives HOT 1
- Update LICENSE and NOTICE
- Codify governance HOT 2
- Resolve exports for native modules
- Errors when importing vue/server-renderer
- Import in the middle breaks `drizzle-orm` exports HOT 3
- Unable to import from Vue HOT 1
- `release-please` GHA fails due to expired access token HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from import-in-the-middle.