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

Runtime Directory Caching Issue (breaks vite config files) #3216

Closed
paperdave opened this issue Jun 5, 2023 · 4 comments
Closed

Runtime Directory Caching Issue (breaks vite config files) #3216

paperdave opened this issue Jun 5, 2023 · 4 comments
Labels
bug Something isn't working bundler Something to do with the bundler

Comments

@paperdave
Copy link
Member

What version of Bun is running?

No response

What platform is your computer?

No response

What steps can reproduce the bug?

const file = `${import.meta.dir}/temp.mjs`;

import { existsSync, unlinkSync, writeFileSync } from "fs";

if (existsSync(file)) {
  console.log("temp.mjs cannot exist before running this script");
  unlinkSync(file);
  process.exit(0);
}

writeFileSync(file, "export default 1;");

try {
  const module = await import(file);
  console.log(module.default);
} finally {
  unlinkSync(file);
}

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

Vite blocker

@paperdave paperdave added the bug Something isn't working label Jun 5, 2023
@Electroid Electroid added the bundler Something to do with the bundler label Jun 6, 2023
This was referenced Jun 6, 2023
@paperdave
Copy link
Member Author

gonna paste this text to make this issue more searchable, this is bug causing vite with config files to crash on startup

$ vite dev
failed to load config from vite.config.js
error when starting dev server:

@paperdave paperdave changed the title Runtime Directory Caching Issue Runtime Directory Caching Issue (breaks vite config files) Jun 7, 2023
paperdave added a commit that referenced this issue Jul 20, 2023
@paperdave
Copy link
Member Author

the fix doesnt strictly fix this bug, but it does fix the case if you're using a query string in the import path, like test.mjs?hello

@paperdave
Copy link
Member Author

tbh

i want to fix this for all cases. the file strictly exists and import() should be able to catch it

@AlbertMarashi
Copy link

Related

vitejs/vite#17851

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bundler Something to do with the bundler
Projects
None yet
Development

No branches or pull requests

3 participants