You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The files struct (Record<string,string>), returned by running Deno.emit has the (semi) correct extensions for the file names (the keys of the struct), but the code inside the emitted output uses the original .ts extension for the import statements.
This requires special handling after emitting the output to search and replace all references to the old file extensions (as using the old ones won't work).
I wrote above that the keys have "semi" correct extensions, because the emit method only appends .js, .js.map & .d.ts to the keys, without considering that the "real" output file shouldn't have .ts in it's name.
Example
You can see below that the output for a.ts.js has import * as b from '/b.ts'; instead of a.ts.js has import * as b from '/b.ts.js';
build.ts
const{files}=awaitDeno.emit("/a.ts",{sources: {"/b.ts": "export const foo=true","/a.ts": "import * as b from '/b.ts';\nconsole.log(b)"}});console.log(files)
command
deno run -q --unstable build.ts
output
{
"file:///b.ts.js.map": '{"version":3,"file":"","sourceRoot":"","sources":["file:///b.ts"],"names":[],"mappings":"AAAA,MAAM,C...',
"file:///a.ts.js.map": '{"version":3,"file":"","sourceRoot":"","sources":["file:///a.ts"],"names":[],"mappings":"AAAA,OAAO,K...',
"file:///a.ts.js": "import * as b from '/b.ts';\nconsole.log(b);\n",
"file:///b.ts.js": "export const foo = true;\n"
}
The text was updated successfully, but these errors were encountered:
Problem
The files struct (
Record<string,string>
), returned by runningDeno.emit
has the (semi) correct extensions for the file names (the keys of the struct), but the code inside the emitted output uses the original.ts
extension for theimport
statements.This requires special handling after emitting the output to search and replace all references to the old file extensions (as using the old ones won't work).
I wrote above that the keys have "semi" correct extensions, because the
emit
method only appends.js
,.js.map
&.d.ts
to the keys, without considering that the "real" output file shouldn't have.ts
in it's name.Example
You can see below that the output for
a.ts.js
hasimport * as b from '/b.ts';
instead ofa.ts.js
hasimport * as b from '/b.ts.js';
build.ts
command
output
The text was updated successfully, but these errors were encountered: