Skip to content
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

feat(@schematics/angular): use TypeScript module preserve option for new projects #28303

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

clydin
Copy link
Member

@clydin clydin commented Aug 28, 2024

Newly generated projects will now use the preserve value for the module option within the TypeScript configuration for the workspace (tsconfig.json). This value was added in TypeScript 5.4 and is intended to model the behavior of modern bundlers such as used in the default application builder. This option value also has the advantage of automatically enabling esModuleInterop and setting moduleResolution to bundler which are the currently generated values for new projects. This allows explicit use of these options to be removed from the generated file. The resolveJsonModule option is also enabled with preserve which removes the need for developers to manually add it if JSON files are imported. JSON file imports are fully support including unused property treeshaking with named imports in the application builder.
Additional details on the option can be found here:
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-4.html#support-for-require-calls-in---moduleresolution-bundler-and---module-preserve

@clydin clydin added the target: major This PR is targeted for the next major release label Aug 28, 2024
@clydin
Copy link
Member Author

clydin commented Aug 28, 2024

There appears to be a TypeScript issue related to preserve and importHelpers.
This change is blocked pending a resolution.
Ref: microsoft/TypeScript#59789

@clydin clydin force-pushed the schematics/use-tsconfig-module-preserve branch from 722e30f to ff0771e Compare August 29, 2024 23:26
@clydin clydin force-pushed the schematics/use-tsconfig-module-preserve branch from ff0771e to 094b1e9 Compare September 10, 2024 16:22
@clydin clydin force-pushed the schematics/use-tsconfig-module-preserve branch from 094b1e9 to 3b0dd49 Compare September 17, 2024 17:44
…new projects

Newly generated projects will now use the `preserve` value for the `module` option
within the TypeScript configuration for the workspace (`tsconfig.json`). This value
was added in TypeScript 5.4 and is intended to model the behavior of modern bundlers
such as used in the default `application` builder.
This option value also has the advantage of automatically enabling `esModuleInterop`
and setting `moduleResolution` to `bundler` which are the currently generated values
for new projects. This allows explicit use of these options to be removed from the generated
file. The `resolveJsonModule` option is also enabled with `preserve` which removes
the need for developers to manually add it if JSON files are imported. JSON file imports
are fully support including unused property treeshaking with named imports in the
`application` builder.
Additional details on the option can be found here:
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-4.html#support-for-require-calls-in---moduleresolution-bundler-and---module-preserve
@clydin clydin force-pushed the schematics/use-tsconfig-module-preserve branch from 3b0dd49 to a7f5b6f Compare November 5, 2024 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: @schematics/angular detected: feature PR contains a feature commit target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant