Skip to content

Commit

Permalink
fix(init): adds a comment to the generated EHR 'mainFields' option
Browse files Browse the repository at this point in the history
- only for commonjs/ non 'type: module' repos

- telling how to put into that field when migrating to ESM (or being on ESM, without having 'type: module' in package.json (which _is_ totally possible)
  • Loading branch information
sverweij committed Mar 5, 2024
1 parent 885d754 commit f8b7839
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cli/init-config/build-config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ function buildMainFieldsAttribute(pInitOptions) {
if (pInitOptions.isTypeModule) {
return `mainFields: ["module", "main", "types", "typings"],`;
}
return `mainFields: ["main", "types", "typings"],`;
return `
// if you migrate to ESM (or are in an ESM environment already) you will want to
// have "module" in the list of mainFields, like so:
// mainFields: ["module", "main", "types", "typings"],
mainFields: ["main", "types", "typings"],`;
}

/**
Expand Down

0 comments on commit f8b7839

Please sign in to comment.