Closed smallmain closed 6 months ago
@smallmain Hi,
Thank you for your feedback. I was added new directive @ctix-declaration
. If the source code file only has an import statement
or declare module statement
, the import statement is added to the build-buldle mode output.
@smallmain Hi,
Thank you for your feedback. I was added new directive
@ctix-declaration
. If the source code file only has animport statement
ordeclare module statement
, the import statement is added to the build-buldle mode output.
awesome!
If the source code file only has an
import statement
ordeclare module statement
If there is this condition, what if a source file can both inject (similar to IOC) and export classes?
/** @ctix-declaration */
@injectable
export class LoginService {}
Even if it is not used directly, it should be included in the final build product, and if there is no import
but only an export
, the tree may be shaken. (The file may also need to be imported first in the header, and even if there is no tree-shaking problem, it is still expected to be imported
first for later injection)
@smallmain
Hi, ctix
is a preprocessor that generates an index.ts
file for bundling. Even if the class is injected using decorator, it will be included in the index.ts
file if you add the export
keyword and add it to the option.include
field. So the @ctix-declaration
will only work if the export keyword is not present.
Now only the export statement will be generated, but the project may have many polyfills files. At this time, you may need to generate a
polyfills.ts
as the entry file, with the following content:Currently, this kind of bucket file can only be maintained manually.
It would be great if you could add a comment at the top of a file, such as
/** @ctix-import */
, which would also add an import statement to the file.And I hope to add a switch in the configuration to be more flexible when there are multiple configuration files in the same project.
Great work!