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

Vite: Use posix paths for glob #21013

Merged
merged 1 commit into from Feb 9, 2023
Merged

Vite: Use posix paths for glob #21013

merged 1 commit into from Feb 9, 2023

Conversation

IanVS
Copy link
Member

@IanVS IanVS commented Feb 8, 2023

Closes storybookjs/builder-vite#554

What I did

New vite projects are failing in Windows because of a change in an updated glob package which enforces forward-slashes for glob paths.

So, we'll use path.posix to join paths in the vite builder for globs.

How to test

I don't have access to a windows box, so I'm not able to test. And we don't test Windows in CI. I'm hoping that maybe @joshwooding or someone else can help test this out.

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

@@ -1,4 +1,4 @@
import * as path from 'path';
import * as posixPath from 'node:path/posix'; // Glob requires forward-slashes
Copy link
Member

Choose a reason for hiding this comment

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

import { join } from 'node:path/posix';? not sure if it makes a difference in node

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you prefer the destructured version? I slightly prefer the namespaced version, just because it's clear when it's being used where it's coming from. posixPath.join() vs just join(). But I don't feel strongly about it and happy to change if you'd like.

Copy link
Member

Choose a reason for hiding this comment

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

Don't feel strongly. I think @ndelangen was making a push towards the namespaced version (but maybe only in browser code, for tree shaking?), so maybe he can comment here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] importers[path] is not a function
2 participants