-
Notifications
You must be signed in to change notification settings - Fork 12
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
Duplicate identifier if using visual studio internal modules? #72
Comments
@mykohsu I would love to help you out, but you haven't really given me much information to go on. Can you please submit a concise gist or some source that I can use to reproduce the issue? TsProject works by combining multiple ES6 source modules into a single ES6 source module/bundle/package. The idea is to package a complete application ( which would have a single main entry point ) or a complete packaged library. The diagnostic error indicates that you have 2 ( or more ) identifiers ( functions, classes, variables, etc.) that have the same name in the bundle. |
@ToddThomson Sorry for the late response. Unfortunately for me I'm limited to what I can post, but will try to put together an example that shows what is happening. Here is the tsproject.json, which is under Scripts\Framework:
And the error message: (6,18) basically refers to There are some other errors due to relative dependencies which are related to #30: where the reference paths are: Here's the folder hierarchy in one place: What I find interesting is that even when considering the base path (Scripts/Framework), TsProject is referring to the incorrect path for Main.ts. Maybe I am not using TsProject for the correct reason. My goal is two parts - 1) to be able to resolve dependencies and output JS in the correct order and 2) split the TS files into separate bundles. |
@mykohsu I haven't looked into your additional information yet, but I have fixed a bug in the 1.2.0-rc.x releases that could cause a duplicate identifier in the bundle compilation. I will be releasing the next rc update as soon as the minification feature has been tested to my satisfaction ( hopefully this week ). |
@mykohsu Would you please provide simple implementations (source) for main.ts, dep1.ts, dep2.ts. I would like to see your import statements and what the dependencies are between the 3 source files. Just keep it really simple! I can tell you that TsProject builds a dependency tree for all the project source files. Since your tsconfig.json does not have a "files" property, all files in your source tree are included. When you specify the bundle "files": ["./class/main.ts"], what you are doing, is telling TsProject to bundle all the dependencies that main.ts has within the set of the project files and construct a single bundled output ts file ( in your case main.ts, main.js and main.d.ts ). Notes:
|
@ToddThomson I actually get the same duplicate identifier without any /// references. Because we are using internal modules, /// references is needed for the TsCompiler otherwise in single file output the order of generated code is based on file hierarchy.
It looks like TsProject is creating a new file main2.ts (using bundle name) with the same contents as Class/Main.ts and compiling main2.ts with Class/Main.ts as a dependency. I've been trying to grab the main2.ts file during compilation but it errors out and the file is deleted too quickly. I can provide a skeleton of the Main class, but you will see that there is really nothing in it:
Does this mean that main.ts should not be part of the source tree? Because in the examples here they are. |
This issue will be addressed in release 1.2.1. |
[TsProject] Scripts/Framework/Class/Main.ts(5,18): error TS2300: Duplicate identifier 'Main'.
The text was updated successfully, but these errors were encountered: