Skip to content

Commit

Permalink
fix(web): readd skipTypeField
Browse files Browse the repository at this point in the history
previously removed and needs to be readded back since nx should always support esm modules with cjs dependencies. Forcing modern libraries to be not in esm format isn't good practice
  • Loading branch information
evanjmg committed Jun 18, 2023
1 parent 1fda800 commit d34674a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/generated/packages/rollup/executors/rollup.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@
"type": "boolean",
"description": "Whether to skip TypeScript type checking.",
"default": false
},
"skipTypeField": {
"type": "boolean",
"description": "Prevent type field from being added to package json. Use this if you have an esm library with common js imports.",
"default": false
}
},
"required": ["tsConfig", "main", "outputPath"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ export function updatePackageJson(
packageJson.main = './index.cjs';
exports['.']['require'] = './index.cjs';
}

packageJson.type = options.format.includes('esm') ? 'module' : 'commonjs';
if (!options.skipTypeField) {
packageJson.type = options.format.includes('esm') ? 'module' : 'commonjs';
}

// Support for older TS versions < 4.5
packageJson.types = types;
Expand Down
1 change: 1 addition & 0 deletions packages/rollup/src/executors/rollup/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ export interface RollupExecutorOptions {
generateExportsField?: boolean;
skipTypeCheck?: boolean;
babelUpwardRootMode?: boolean;
skipTypeField?: boolean;
}
5 changes: 5 additions & 0 deletions packages/rollup/src/executors/rollup/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@
"type": "boolean",
"description": "Whether to skip TypeScript type checking.",
"default": false
},
"skipTypeField": {
"type": "boolean",
"description": "Prevent type field from being added to package json. Use this if you have an esm library with common js imports.",
"default": false
}
},
"required": ["tsConfig", "main", "outputPath"],
Expand Down

0 comments on commit d34674a

Please sign in to comment.