-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Add script config for adding scripts as type="module" #24592
Comments
This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list. You can find more details about the feature request process in our documentation. |
@alan-agius4 |
Also interested if there is any progress in this... It's quite serious, because some third party libs started shipping/working with exclusively |
When the script is in ESM, you can directly import it in @bernatgy, it's preferable to use the explicitly imported script instead of relying on the prebuilt global script. This ensures that Dead Code Elimination (DCE) and tree-shaking optimizations can be applied to the library. Example: import { getDocument } from "pdfjs-dist";
const loadingTask = getDocument(pdfPath); The |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
build, config
Description
Looking at the script config https://angular.io/guide/workspace-config#style-script-config there does not seem to be any way to add the scripts as type="module" for esm.
If the third party script is delivered as an Es Module it cant be imported in the angular.json.
Seems like there is some thought about this
angular-cli/packages/angular_devkit/build_angular/src/utils/index-file/augment-index-html.ts
Line 94 in d086d17
This comment may be the one of why it won't add type="module"
angular-cli/packages/angular_devkit/build_angular/src/utils/index-file/augment-index-html.ts
Line 79 in d086d17
Describe the solution you'd like
Add a new setting to the script config, something like.
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: