rspack
rspack copied to clipboard
support shim global with modules
It's very common that some third party library use some non standard global variable like global、process
module.exports = {
builtins: {
provide: {
'global': './shims/global.js'
}
}
}
like https://webpack.js.org/plugins/provide-plugin/
It's very common that some third party library use some non standard global variable like
global、processmodule.exports = { builtins: { provide: { 'global': './shims/global.js' } } }like https://webpack.js.org/plugins/provide-plugin/
Is someone working on this? We want to use rspack in our project but we need to "provide" things like process, buffer, etc. I can create a PR if no one is currently working on this.
I can create a PR if no one is currently working on this.
No one is currently working on this. But if you're interested in contributing, don't hesitate to open a pull request! Once it's submitted, I'll be happy to review it.
And if you need any guidance, feel free to reach out to me on Discord or GitHub.
Thank you in advance.
there's a workaround with it right now and we also use it in internal projects
- rspack.config.js
module.exports = {
entry: {
main: ['./shims.js', './src/index.js']
}
}
- shims.js
var global = globalThis;
Thanks for replying @hyf0 @hardfist. I am almost half-way through the PR adding provide as a builtin. Hopefully will get some more work done during the weekend
Closed by #2492