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.compile caching/cache-busting not behaving as expected #4743

Closed
jakajancar opened this issue Apr 14, 2020 · 2 comments · Fixed by #8328
Closed

Deno.compile caching/cache-busting not behaving as expected #4743

jakajancar opened this issue Apr 14, 2020 · 2 comments · Fixed by #8328
Assignees
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@jakajancar
Copy link

test.ts

console.log('Hello')

main.ts

setInterval(async () => {
    const start = +new Date
    const [ diagnostics, emitMap ] = await Deno.compile('./test.ts')
    console.log(`Took ${+new Date - start} ms to compile`)
    console.log(emitMap)
}, 1000)

deno main.ts output

Took 357 ms to compile
{
 file:///Users/jaka/Desktop/deno-compile-caching/test.js.map: "{\"version\":3,\"file\":\"test.js\",\"sourceRoot\":\"\",\"sources\":[\"test.ts\"],\"names\":[],\"mappings\":\";AAAA,OAA...",
 file:///Users/jaka/Desktop/deno-compile-caching/test.js: "\"use strict\";\nconsole.log('Hello');\n//# sourceMappingURL=test.js.map"
}
[... identical output infinitely ...]

The Deno.compile() always takes 300ms+ and the output does not change even if test.ts is changed while the script is running. Curiously, mtime of test{.ts.js,.ts.js.map,.meta} in the cache directory are changing.

Expected:

  • When not changed: returns instantly, does not change files cache
  • When changed: takes a while, picks up changes, changes files in cache

Actual:

  • When not changed: takes a while, changes files in cache
  • When changed: takes a while, does not pick up changes, changes files in cache

deno 0.40.0

@bartlomieju
Copy link
Member

Most likely caused by caching in SourceFileFetcher and/or caching in TsCompiler. Both of them have a hashmap with already loaded files.

@kitsonk
Copy link
Contributor

kitsonk commented Nov 9, 2020

This is still present in 1.5.2... it is due to the FileFetch in memory cache not reloading the source, like a few other issues.

@kitsonk kitsonk self-assigned this Nov 9, 2020
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