swc
swc copied to clipboard
Can I get or set global variables in Node.js when I am using SWC?
Discussed in https://github.com/swc-project/swc/discussions/9526
Originally posted by zhangmingyuan666 September 3, 2024 I am using rspack in Node.js, and use swc-loader as the loader of js files. I need to get or set some global variables in node.js to do something.
In babel plugin, I always use global like global.storeInfo to get global variables in node.js.
But in swc plugin, I have to write plugin in rust environment and then build it as wasm to work in Node.js environment. Can I get or set node.js global variables in swc plugin?
My Node version is 18.18.0, my swc plugin's swc_core version is 0.91.0