kubeshop / vscode-monokle

An extension for Visual Studio Code to validate your Kubernetes configuration
https://marketplace.visualstudio.com/items?itemName=kubeshop.monokle
MIT License
6 stars 0 forks source link

Use static import for @monokle/validation #8

Open f1ames opened 1 year ago

f1ames commented 1 year ago

The @monokle/validation library is now imported dynamically due to some errors with building and static import which I wasn't able to solve in reasonable amount of time:

https://github.com/kubeshop/vscode-monokle/blob/d916d170633535ba96095d011a665b17a94ff4b8/src/utils/validation.ts#L168-L171

But this makes it a bit harder to work with and e.g. cumbersome to import types.


One of the errors was:

Error [ERR_REQUIRE_ESM]: require() of ES Module monokle-vsc/node_modules/@monokle/validation/lib/node.js from monokle-vsc/out/extension.js not supported.
Instead change the require of node.js in monokle-vsc/out/extension.js to a dynamic import() which is available in all CommonJS modules.
f1ames commented 1 year ago

Just a small update since I encountered this issue with other ESM-only modules. There is an open issue regarding this so not sure if this is (easily) doable - https://github.com/microsoft/vscode/issues/130367.

f1ames commented 1 year ago

Did first (unfortunately unsuccessful) attempt with https://github.com/kubeshop/monokle-core/pull/479.