-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the Dependency on Babel: Allow Prebid to be used with any build system #10086
Comments
@cameron-brown-future we'd welcome your contribution to get this working, thanks! |
Hey @dgirardi! First of all, thanks for your contributions to this amazing repo 🙏 I think I might be having similar issues as I am using Next.js and SWC in my project. I agree that the best solution to this issue would be to remove the need for the precompilation step and allow consumers to just directly import modules. I've noticed that there is already a solution #8175 for the issue, but the PR has not been merged yet. Is there a workaround for now? And do you need any help to get it merged sooner? I think I can jump in if needed 🙏 Thank you 🙌 |
@ilyaryabchinski I am not happy with that PR for several reasons - but if it solves this problem for you I can try to get it in as a temporary workaround. It essentially makes what you get from the download page available through NPM. I think the "real" solution is split the compilation in two steps:
I am not sure how to deal with compile-time feature flags in step 1 ( |
For npm consumers the ideal way IMO would be to avoid Babel/swc/new_fancy_js_transpiler precompilation step on the consumer project build system side and make all the features/modules to be pluggable. In this case I can avoid changing my build system and the Prebid usage would be as simple as: importing the core module and then importing the modules that I need for my header bidding configuration. Not sure if it's feasible since I'm obviously not familiar with the project constraints but seems like it may affect building discrete chunks for the download page 🤔 |
We've just encountered the same issue while trying out rspack (A rust-based replacement for webpack) This supports the idea posed by @dgirardi and @ilyaryabchinski that a more generic solution that removes the need for any pre-compiation would be better than just supporting the shiniest new compiler. |
Type of issue
Feature request
Description
The SWC loader is much faster than the babel loader, it would be ideal if the prebid node module could add support to be compiled with this loader if desired.
Speculation:
The babel loader is currently required to replace certain compilation variables or perform other complex logic, and requires a special babel config. It is unknown if SWC supports the abilities required to replace this, but if it does it should be used for performance reasons.
SWC also may increase the package size, but has minification options that may even reduce the package size if used properly, this would need to be taken into account before committing to supporting SWC
Steps to reproduce
prebid.js
npm i --save-dev @swc/core swc-loader
babel-loader
withswc-loader
in the webpack configExpected results
The code compiles and runs as normal if SWC is used, perhaps with some additional config.
Actual results
When using the
swc-loader
instead of thebabel-loader
a reference error for$$DEFINE_PREBID_GLOBAL$$
occurs when running the compiled code.The text was updated successfully, but these errors were encountered: