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

Support ESM #710

Closed
ahnpnl opened this issue Jan 6, 2021 · 1 comment
Closed

Support ESM #710

ahnpnl opened this issue Jan 6, 2021 · 1 comment
Labels

Comments

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jan 6, 2021

🚀 Feature Proposal

Support compilation to ESM for both isolatedModules: false and isolatedModules: true. Potential work:

  • Adjust inline-files and strip-styles transformers to transform to ESM compatible codes, like the way replace-resources does. This is important for isolatedModules: true because it doesn't use TypeScript Program therefore it can't reuse inline-resources transformer.
  • Adjust isolatedModules: false compilation path to accept module ESM values, including ES2015/ES2020 and ESNext for compiler options. Currently isolatedModules: true already did it.
  • Investigate to see if replace-resources can be used for isolatedModules: true.

Motivation

Allow users to switch to ESM when they want.

Example

Test and check whether ESM output is produced

@ahnpnl ahnpnl added the 🚀 Feature Request new suggested feature label Jan 6, 2021
@ahnpnl ahnpnl pinned this issue Jan 6, 2021
ahnpnl added a commit that referenced this issue Jan 7, 2021
…717)

Copy source code of TypeScript `transpileModule` so that we can get `Program` which is created in that function which then allows us to use `replace-resources` transformer from Angular.

This also provides fully compatibility to ESM for `isolatedModules: true`, related to #710 

BREAKING CHANGE
- `inline-files` and `strip-styles` are removed from `jest-preset-angular` and now `jest-preset-angular` always uses Angular `replace-resources` instead for both `isolatedModules: false` and `isolatedModules: true`.
- The transformers in your jest config
```
'jest-preset-angular/build/InlineFilesTransformer'
'jest-preset-angular/build/StripStylesTransformer'
```
or
```
'jest-preset-angular/build/transformers/inline-files'
'jest-preset-angular/build/transformers/strip-styles'
```
must be removed
ahnpnl added a commit that referenced this issue Jan 11, 2021
@ahnpnl
Copy link
Collaborator Author

ahnpnl commented Jan 11, 2021

Close via #717 #721 #723

@ahnpnl ahnpnl closed this as completed Jan 11, 2021
@ahnpnl ahnpnl unpinned this issue May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant