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

Deno.bundle uses cache #5631

Closed
amatiasq opened this issue May 19, 2020 · 3 comments · Fixed by #8328
Closed

Deno.bundle uses cache #5631

amatiasq opened this issue May 19, 2020 · 3 comments · Fixed by #8328
Assignees
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@amatiasq
Copy link

I'm creating a script:

deno --allow-read=. --allow-net https://amatiasq.com/deno/web.ts my-script.ts

That watches the file system and bundles my-script.ts into a frontend-ready file.

The issue is that when a file system event is detected Deno.bundle bundles again from cache. Making the tool unusable.

I wasn't able to find a way to clear cache, I tried starting a process deno bundle my-script.ts but that doesn't allow me to pass a custom tsconfig to add lib: ["DOM"].

@sholladay
Copy link

As a workaround, maybe you could run deno cache before deno bundle, each time the watcher triggers.

@amatiasq
Copy link
Author

@sholladay good idea!

I tried this before the bundle:

  await Deno.run({
    cmd: ['deno', 'cache', file],
  }).status();

And now suddenly Deno.bundle is ignoring the lib parameter:

  const [diagnostics, content] = await Deno.bundle(file, undefined, {
    lib: ['dom'],
  });

Since it throws:

error: TS2584 [ERROR]: Cannot find name 'document'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'.
const potato = document.querySelector('canvas');
               ~~~~~~~~
    at file:///Users/amatiasq/repos/deno-test/deno-test/run.ts:1:16

That same error doesn't happen if I comment the deno cache execution 😮

@bartlomieju
Copy link
Member

Same problem as in #4743 and #5253

@bartlomieju bartlomieju added bug Something isn't working correctly cli related to cli/ dir labels May 21, 2020
@bartlomieju bartlomieju self-assigned this May 21, 2020
@bartlomieju bartlomieju mentioned this issue Oct 10, 2020
22 tasks
kitsonk added a commit that referenced this issue Nov 16, 2020
Fixes #4743
Closes #5253
Fixes #5631
Fixes #6116

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
jannes pushed a commit to jannes/deno that referenced this issue Dec 1, 2020
Fixes denoland#4743
Closes denoland#5253
Fixes denoland#5631
Fixes denoland#6116

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants