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: Cannot find module '.\dir\foo.js' under windows #53

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 15 additions & 23 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"projectOwner": "OpenSourceRaidGuild",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"files": ["README.md"],
"imageSize": 100,
"commit": false,
"commitConvention": "none",
Expand All @@ -15,57 +13,51 @@
"name": "Michael Peyper",
"avatar_url": "https://avatars.githubusercontent.com/u/23029903?v=4",
"profile": "https://github.com/mpeyper",
"contributions": [
"code",
"test",
"doc"
]
"contributions": ["code", "test", "doc"]
},
{
"login": "nobrayner",
"name": "Braydon Hall",
"avatar_url": "https://avatars.githubusercontent.com/u/40751395?v=4",
"profile": "https://github.com/nobrayner",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "MohitPopli",
"name": "Mohit",
"avatar_url": "https://avatars.githubusercontent.com/u/17976072?v=4",
"profile": "https://github.com/MohitPopli",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "rubenmoya",
"name": "Rubén Moya",
"avatar_url": "https://avatars.githubusercontent.com/u/905225?v=4",
"profile": "https://rubenmoya.dev/",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "mitchelvanbever",
"name": "Mitchel van Bever",
"avatar_url": "https://avatars.githubusercontent.com/u/10127707?v=4",
"profile": "https://github.com/mitchelvanbever",
"contributions": [
"ideas"
]
"contributions": ["ideas"]
},
{
"login": "vctqs1",
"name": "vctqs1",
"avatar_url": "https://avatars.githubusercontent.com/u/30227910?v=4",
"profile": "https://github.com/vctqs1",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "DesselBane",
"name": "DesselBane",
"avatar_url": "https://avatars.githubusercontent.com/u/12199480?v=4",
"profile": "https://github.com/DesselBane",
"contributions": ["code"]
}
],
"contributorsPerLine": 8
}

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="12.5%"><a href="https://github.com/MohitPopli"><img src="https://avatars.githubusercontent.com/u/17976072?v=4?s=100" width="100px;" alt="Mohit"/><br /><sub><b>Mohit</b></sub></a><br /><a href="https://github.com/OpenSourceRaidGuild/babel-vite/commits?author=MohitPopli" title="Code">💻</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://rubenmoya.dev/"><img src="https://avatars.githubusercontent.com/u/905225?v=4?s=100" width="100px;" alt="Rubén Moya"/><br /><sub><b>Rubén Moya</b></sub></a><br /><a href="https://github.com/OpenSourceRaidGuild/babel-vite/commits?author=rubenmoya" title="Code">💻</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/mitchelvanbever"><img src="https://avatars.githubusercontent.com/u/10127707?v=4?s=100" width="100px;" alt="Mitchel van Bever"/><br /><sub><b>Mitchel van Bever</b></sub></a><br /><a href="#ideas-mitchelvanbever" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/vctqs1"><img src="https://avatars.githubusercontent.com/u/30227910?v=4?s=100" width="100px;" alt="vctqs1"/><br /><sub><b>vctqs1</b></sub></a><br /><a href="https://github.com/OpenSourceRaidGuild/babel-vite/commits?author=vctqs1" title="Code">💻</a> <a href="https://github.com/OpenSourceRaidGuild/babel-vite/commits?author=vctqs1" title="Documentation">📖</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/vctqs1"><img src="https://avatars.githubusercontent.com/u/30227910?v=4?s=100" width="100px;" alt="vctqs1"/><br /><sub><b>vctqs1</b></sub></a><br /><a href="https://github.com/OpenSourceRaidGuild/babel-vite/commits?author=vctqs1" title="Code">💻</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/DesselBane"><img src="https://avatars.githubusercontent.com/u/12199480?v=4?s=100" width="100px;" alt="DesselBane"/><br /><sub><b>DesselBane</b></sub></a><br /><a href="https://github.com/OpenSourceRaidGuild/babel-vite/commits?author=DesselBane" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
10 changes: 7 additions & 3 deletions packages/babel-plugin-transform-vite-meta-glob/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export default function viteMetaGlobBabelPlugin({
t.isStringLiteral(args[0])
) {
const cwd = nodePath.dirname(sourceFile)
const globPaths = globSync(args[0].value, { cwd, dotRelative: true }).sort()
const globPaths = globSync(args[0].value, { cwd, dotRelative: true })
.sort()
.map((globPath) => globPath.replace(/\\/g, '/'))

const replacement = t.objectExpression(
globPaths.map((globPath) =>
Expand Down Expand Up @@ -85,7 +87,9 @@ export default function viteMetaGlobBabelPlugin({
t.isBooleanLiteral(eagerOption[0].value)
) {
const cwd = nodePath.dirname(sourceFile)
const globPaths = globSync(args[0].value, { cwd, dotRelative: true }).sort()
const globPaths = globSync(args[0].value, { cwd, dotRelative: true })
.sort()
.map((globPath) => globPath.replace(/\\/g, '/'))
Comment on lines -88 to +92
Copy link
Member

@mpeyper mpeyper Jan 16, 2024

Choose a reason for hiding this comment

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

thoughts (non-blocking): at what point should we extract a function for this to ensure this and the above stay in sync?


if (eagerOption[0].value.value) {
const identifiers = globPaths.map((_, idx) => t.identifier(`__glob__0_${idx}`))
Expand All @@ -97,7 +101,7 @@ export default function viteMetaGlobBabelPlugin({
identifiers[idx],
t.callExpression(t.identifier('require'), [modulePath])
)
]);
])
})

const variable = t.variableDeclaration('const', [
Expand Down
Loading