aleph.js icon indicating copy to clipboard operation
aleph.js copied to clipboard

improve compiler import resolve

Open ije opened this issue 4 years ago • 6 comments
trafficstars

using timestamp to replace hash in dev mode to avoid the complex compilation sideEffect.

ije avatar Feb 05 '21 06:02 ije

What complex compilation side effect?

shadowtime2000 avatar Feb 05 '21 19:02 shadowtime2000

@shadowtime2000 please check https://github.com/alephjs/aleph.js/blob/05592c5aae90e06f5a6641fda7ef28c599915e8b/server/app.ts#L1038

ije avatar Feb 05 '21 19:02 ije

i want to remove the hash in import urls, because when a module changed, we need to update the dep graph, but if without hash the ssr will use the cached module in deno cache storage not the re-compiled moudle when module changed.

ije avatar Feb 05 '21 19:02 ije

@shadowtime2000 do you know why this can not work:

const a = await import("data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=")
console.log(a.a)

error: Uncaught (in promise) TypeError: Unmapped bare specifier "data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo="

ije avatar Feb 05 '21 20:02 ije

Strange, seems to work for me @ije

shadowtime2000 avatar Feb 05 '21 20:02 shadowtime2000

i figured out, if i pass the --import-map option, the data url will break...

ije avatar Feb 05 '21 21:02 ije