Skip to content
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

fix: build standalone on windows #14462

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions Gulpfile.mjs
Expand Up @@ -297,6 +297,15 @@ function buildRollup(packages, targetBrowsers) {
input,
external,
onwarn(warning, warn) {
function normalizePath(str) {
return typeof str == "string"
? str.split(path.sep).join(path.posix.sep)
: str;
}

warning.importer = normalizePath(warning.importer);
warning.exporter = normalizePath(warning.exporter);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since warning is a Rollup object that we pass back to rollup, I'd prefer if we could avoid modifying it.
Instead, we can create an osifyPath = str => str.split("/").join(path.sep) function and do warning.exporter === osifyPath("packages/babel-core/src/index.ts") below ("osify" = "make it like the os").

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right! We should not modify this object.

The requested change has been completed.

But it looks a bit odd that "@babel/helper-define-polyfill-provider" -> "@babel\helper-define-polyfill-provider"

And this is a little inconvenient, we need to copy and paste osifyPath when adding new conditions.

Maybe we can deep clone the warning object, which is a small object.


if (warning.code === "CIRCULAR_DEPENDENCY") return;
if (warning.code === "UNUSED_EXTERNAL_IMPORT") {
warn(warning);
Expand Down