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
Don't include "resolve" in @babel/standalone #11432
Don't include "resolve" in @babel/standalone #11432
Conversation
Is there any way to add a test for this? |
I tried to search for a rollup option to disallow some modules, but I couldn't find it. |
It is still including |
@@ -11,6 +11,10 @@ | |||
"keywords": [ | |||
"babel-plugin" | |||
], | |||
"browser": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it suffices to set preferBuiltins: false
when building babel-standalone, so it can warn us on builtin imports which is not yet covered by rollup-plugin-node-polyfill.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh but it will not cover cases like resolve
is imported. Maybe we can do something like
{
name: "warn-browser-unsupported-modules",
resolveId(...args) {
const [source] = args;
if (["resolve"].includes(source)) {
throw new Error(`${source} can not be bundled into @babel/standalone!`);
}
return this.resolve(...args);
}
}
Anyway I am happy if we merge it as-is and postpone to another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm merging this for now and I will investigate. I'm surprised that I can't find a plugin that does what we need 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolo-ribaudo You may checkout https://github.com/dumbmatter/rollup-plugin-blacklist but I am not strongly for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask why don't you like it?
Starting from browserify/resolve#217,
resolve
unconditionally uses thefs
object (even if we don't call anyresolve
function).This is a problem in
@babel/standalone
sincefs
isn't available there. However,resolve
shouldn't have been included in@babel/standalone
in the first place 🤷