Deno: bug(Worker): Not loading latest version of specified script

Created on 5 Jun 2020  路  5Comments  路  Source: denoland/deno

Steps to reproduce

  1. Create a file script.ts with the content console.log('hello').
  2. Create another file main.ts with the following content:
while(true) {
  const worker = new Worker('./script.ts', {type: 'module'})
  await new Promise(resolve => setTimeout(resolve, 1000))
  worker.terminate()
}
  1. Run this command: deno run --allow-read main.ts.
  2. Modify the content of script.ts to console.log('bye') and save it.

Expected result

The subsequent log of deno run --allow-read main.ts should be bye.

Actual result

After step 4, the subsequent log of deno run --allow-read main.ts is still hello.

Environment:

macOS Catalina (v10.15.4)
$ deno --version
deno 1.0.5
v8 8.4.300
typescript 3.9.2

Is this introduced lately?

No, this is happening on every version of Deno since v1.0.0 until v1.0.5.

Current workaround

Refer https://stackoverflow.com/a/41790024/6587634

bug cli

Most helpful comment

Thanks for the report. I guess it's related to our module cache - it should be bypassed for dynamic loads (Worker constructors and dynamic imports).

@bartlomieju what do you think?

All 5 comments

Thanks for the report. I guess it's related to our module cache - it should be bypassed for dynamic loads (Worker constructors and dynamic imports).

@bartlomieju what do you think?

Yes, this is the same problem as in #5631 and #4743

While it hasn't fixed #5631 and #4743, I believe the compiler refactor has fixed this one, but I need to create a test to validate that.

I just tried the reproduction with 1.5.2 and it works as expected.

Sorry - I didn't understand the example correctly. This is still a bug.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidbarratt picture davidbarratt  路  3Comments

metakeule picture metakeule  路  3Comments

ry picture ry  路  3Comments

ry picture ry  路  3Comments

kitsonk picture kitsonk  路  3Comments