Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support removeModule API #119

Open
1 task
dolymood opened this issue Aug 6, 2021 · 6 comments
Open
1 task

[Feature] Support removeModule API #119

dolymood opened this issue Aug 6, 2021 · 6 comments

Comments

@dolymood
Copy link

dolymood commented Aug 6, 2021

  • I'd be willing to implement this feature

Describe the user story

We will remove virtual modules in some cases.

Describe the solution you'd like

In watch mode, we can remove virtual modules to release memory.

Describe the drawbacks of your solution

New API.

Describe alternatives you've considered

Additional context

@rnarcos
Copy link

rnarcos commented Apr 11, 2023

I find this use case to be interesting.

I'm using webpack-virtual-modules to virtualize some of the modules that are "required" so that they won't break the application. One thing that upsets me is that the virtual modules will always take precedence over the physical files.

What I'd like to have is the flexibility to "unsubscribe" the virtual modules in favor of files that are now present my working directory and I think that the removeModule API would be fundamental for it.

Do you see any objections to this implementation, @larixer?

@larixer
Copy link
Member

larixer commented Apr 11, 2023

@rnarcos No objections, I would merge it, if tests will pass and the code quality will be okay-ish

@rnarcos
Copy link

rnarcos commented Apr 11, 2023

Any way that I can be in closer contact with you (or any other contributor associated to this project) in order to get a clearer vision about environment setup and contribution guide?

@larixer
Copy link
Member

larixer commented Apr 11, 2023

@rnarcos As a core team member of Yarn package manager I'm available at a Yarn's discord:
https://discord.com/invite/yarnpkg
You are welcome to direct message me there.

@fringd
Copy link

fringd commented Aug 28, 2023

hey i think i'm trying to do the same thing as you... basically i'm replacing a module dynamically as i rebuild. i can REPLACE the fake contents with new fake contents by calling writeModule again... but i can't go back to the original easily...

it seems like

delete compiler.inputFileSystem._virtualFiles[filename];
compiler.inputFileSystem.purge(filename);

is doing the thing that i want?

edit: no it's not.... dang. but i would really like this feature...

@fringd
Copy link

fringd commented Aug 29, 2023

as a workaround i'm doing writeModule(filename, fs.readFileSync(filename)) if anybody else is stuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants