Replace the global variable __dirname used with an alternative that properly handles special characters and is more widely supported
Use Case
I've seen issues in #21161, and #18470, and may be running into issues myself due to path resolution shenanigans on my system with the __dirname global variable.
Proposed Solution
It seems feasible from my limited knowledge of Node.js to use path.dirname(url.fileURLToPath(import.meta.url)) instead, given its introduction back in Node.js 10.12.
Other Information
No response
Acknowledgements
[ ] I may be able to implement this feature request
Can you elaborate more about this issue? What is the current behavior and what is the expected behavior? A small code snippet provided would be highly appreciated as well.
Describe the feature
Replace the global variable
__dirname
used with an alternative that properly handles special characters and is more widely supportedUse Case
I've seen issues in #21161, and #18470, and may be running into issues myself due to path resolution shenanigans on my system with the
__dirname
global variable.Proposed Solution
It seems feasible from my limited knowledge of Node.js to use
path.dirname(url.fileURLToPath(import.meta.url))
instead, given its introduction back in Node.js 10.12.Other Information
No response
Acknowledgements
CDK version used
2.80.0
Environment details (OS name and version, etc.)
NixOS 23.05