-
Notifications
You must be signed in to change notification settings - Fork 195
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
Creating source maps on directory emission #658
Comments
@marikaner sorry, for my delay:
This is probably what you will want to do it if those tsconfig.json files in each directory have different settings that could affect the emit. Under the hood, the emit is driven by the "program", each program has a single configuration, and there is one program per ts-morph "project" object. So, you'll want to load one project per tsconfig.json. Yeah, that will probably cause it to use a lot of memory because it's not sharing node modules anymore. To deal with the memory issue, you may want to only open one project at a time or increase the memory usage. It will also probably be a lot slower because it will have to parse a lot of the shared files many times instead of once. I've opened #660 to try to deal with this.
I'll look into these issues soon. Could you post the configuration (tsconfig) you're using? |
I resorted to using just one project, which is perfectly fine in my case as the configs are all the same. I am not using a {
addFilesFromTsConfig: false,
manipulationSettings: {
indentationText: IndentationText.TwoSpaces,
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true,
quoteKind: QuoteKind.Single
},
compilerOptions: {
target: ScriptTarget.ES5,
module: ModuleKind.CommonJS,
declaration: true,
declarationMap: true,
sourceMap: true,
diagnostics: true,
moduleResolution: ModuleResolutionKind.NodeJs,
esModuleInterop: true,
inlineSources: false,
noImplicitAny: true
}
} In addition, for emitting the directories I was using |
More detailed follow up on #656
I have a project where I generate multiple (more than 120) modules:
Up to now I have been transpiling the sources in a separate step on my own. Now I want to do this as part of the generation using ts-morph.
The result is supposed to be something like this:
Now I wonder how to achieve this or whether this is even possible.
What I tried:
I created multiple projects and tried to save + emit those asynchronously. This fails because Javascript runs out of memory. This works for just saving, but as soon as I add emission, I run out of memory. I suppose this is not intended and not a good idea. (Right?)
I created one project for all modules. Saving the project works as usual.
a. I emmitted the whole project at once. With this approach I don't see any possibility to specify multiple outDirs, to my understanding this is not supported by the tsconfig.json.
b. I emitted all module directories with
{ outDir: 'dist' }
. This approach has two problems:d.ts.map
files are not in the outdir:js.map
file do not link to the correct sources: I need it to be../someFileX.ts
but it issomeFileX.ts
. I am not sure that this is intended, but if it is I don't see any option to actually enable this behavior.It is not 100% clear to me how emit on directories should work and whether this is a valid approach at all...
Possibly this is just a bug, if the two issues are connected. It could as well be a new feature that allows to set the
baseUrl
?To my understanding setting the
mapRoot
in the project is not helpful in this case.The text was updated successfully, but these errors were encountered: