webpack-cli icon indicating copy to clipboard operation
webpack-cli copied to clipboard

feat: dot-env plugin

Open info-arnav opened this issue 1 year ago • 18 comments

This PR adds a plugin directory with a basic dot-env support plugin.

I am not sure on how to go about it further. But provides a basic program in the plugin directory.

#3747

info-arnav avatar Mar 14 '24 18:03 info-arnav

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: info-arnav / name: Arnav Gupta (67d08dbb0f75b9a1ef7e57bbc29f68079ee33fca, 75ec38fc7a5494ae80f5db31cdf045a1975e9fe7, 5ae5ffab3027b81422d267e6759c10ff9834dabe, 749165147238098fd988340f9905174158c90510, e60dffb58e0c3ca8e61b679aa51db551ed8e1fba, 1bb6371eeb1bdf007dfe3fc0597db6dc773af0bd, 9fd7dca7e96be5b43af712f647aac4c455e028a5, ad0f84205591780212423e1a497dd3a729d0cd0f, 80d7233087a7acd732f107a1b520f2d22f7039bc, 4355ebc377fe0963f17554b65d9ac31642e94b22, 7c1811fd18e59966a41fc1533ae5e3228cf794bb, 626916327319cf5993cbf47815b2719c1d34c119, 1591b8d49294dfee9f5d0cd86fbba7c1bfd043fe, 8ee21441011e6c2f4386abd6f2391c8e85b18ed1, efeff89924e2c6602422ae0f8ec2487add5aeecc, 7ed46521e507a8709c4597d3284709af27dc0043, 41385a0c99e050027030b52af2bce4c7fa8a3fcc, 78c59c89b55a67ef6606954ce15bf6d22fce514e, 93a45c89a0eeecc34f7a14e376977b6927f320bb, e3c4bb454191e3cd965bbea54380200dcb011644, 06bc78d7fe1533af7915fa79327472b95a323f75, 4c53402d97acff2840701f66ea162bfad1b49358, 570449265039469c57b51d4a37053ab8bed3447d, 98499d39afa48556fb73016d31d72827bed3f422, 9d2cae105b5f58a469ed1b314cae4c4a4eaa1797, e471b42e41ee4ec2ba314da70a3f88add765c18d, 14062c52b3aadecb2f346cb2b29e2a0d1f6174b2, f4f53b8f737eb6a69f3ce7af114e5099a99389ab, f45788a872ed0a7ea3ae743a9681f73f11d1ce6a, 132d757e2e8a110d2056157a41ff215025cc683c, ef9e1636f346bebc29e26f83f8eb40028bac4e80, 78eac3953440b9e343dbd9ff239070fd4a228c8e, 969181edc9ae7575cda8ba3512fd723fa4b5ba55, b3049cf2dab5f9e5ca0c4e0319dc5ebf5dbe3716, 143344b3cdc91c634b9646a91156e7ad8a465998, 5a1e693f0e7111b553dc6ef9b6deee4ae5926d03, da567e9c7735d0e800e4c85902b145ab2eafe510, f214c62844534723b2d3165cb46c6d51b802b665, 903104b55d9666bdf794ede49076490c784dcc41, 61fc823bc5f794c99be0edd120c19a608e700655, 7c4e8c8bcd04f3d17e4b4feb2013f2ba744771a9, 397d73a0c28045719622043ff26ab82c9921231c, a51a1fc74c61588fbc0334385bd3a752c909c2db)

We need something like https://github.com/mrsteele/dotenv-webpack, just rewrite it on using cache (i.e. inputFileSystem) and more refactor

alexander-akait avatar Mar 15 '24 11:03 alexander-akait

I have made some changes, add the caching to internal file system and refactored everything a bit

info-arnav avatar Mar 20 '24 20:03 info-arnav

@info-arnav Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@alexander-akait Please review the new changes.

webpack-bot avatar Mar 23 '24 13:03 webpack-bot

#3759

info-arnav avatar Mar 25 '24 18:03 info-arnav

I am adding the tests as well

info-arnav avatar Mar 27 '24 11:03 info-arnav

After then we finish it, we will move it in own workspace, like other packages, but it is not a big problem, so let's focus on improvements and tests

alexander-akait avatar Mar 27 '24 13:03 alexander-akait

Now changing the cache to webpack cache

info-arnav avatar Mar 27 '24 21:03 info-arnav

used Map instead of wekmap, hope that works ?

info-arnav avatar Mar 28 '24 11:03 info-arnav

Ill conduct the tests and update tom

info-arnav avatar Apr 03 '24 20:04 info-arnav

Solving the remaining two issues as well

info-arnav avatar Apr 03 '24 20:04 info-arnav

please ask more if you do not understand, the previous version was more correct

so, shall i rever it back to synchronous running and then make the changes suggested ?

info-arnav avatar Apr 04 '24 18:04 info-arnav

@alexander-akait I tried to make changes, but like if i am using async then the tests arent executing and even the environment hooks are failing. Shall i make the other chaneges u said and revert stuff to a synchronous manner ?

info-arnav avatar Apr 06 '24 20:04 info-arnav

@alexander-akait I have a asynchronous version as well, please let me know if i should upload that as well, if that is a major requirment.

info-arnav avatar Apr 06 '24 21:04 info-arnav

@alexander-akait can you please guide me on where to get the types for the logger. For input file system the type can not be used as we are using readFileSync

info-arnav avatar Apr 12 '24 19:04 info-arnav

@alexander-akait can you please guide me on where to get the types for the logger. For input file system the type can not be used as we are using readFileSync

please let me know about the hook also, as using initialize will remove the compilation object. so compilation.errors.push and compilation.cache wont work

info-arnav avatar Apr 12 '24 19:04 info-arnav

@alexander-akait at line 58 I tried adding a

compiler.hooks.compilation.tap

inside the

compiler.hooks.initialize.tap

does that make sense ?

info-arnav avatar Apr 21 '24 20:04 info-arnav

Also do you think adding a readFile in the compilation hook and SyncReadFile in the initilize hook makes sense ? As in we check if the compilation object was passed as an argument, if it was we proceed in an asynchronous way, else synchronous

@alexander-akait at line 58 I tried adding a

compiler.hooks.compilation.tap

inside the

compiler.hooks.initialize.tap

does that make sense ?

info-arnav avatar Apr 21 '24 20:04 info-arnav

open a fresh pr please

evenstensberg avatar Sep 25 '24 19:09 evenstensberg