Skip to content

Commit

Permalink
remove module from node only pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
snowystinger committed Oct 14, 2022
1 parent 5862a6d commit 1cde05e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 0 additions & 4 deletions packages/@internationalized/string-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
"description": "Localized string compiler for @internationalized/string",
"license": "Apache-2.0",
"main": "src/stringCompiler.js",
"exports": {
"import": "./undefined",
"require": "./src/stringCompiler.js"
},
"types": "src/stringCompiler.d.ts",
"files": [
"src"
Expand Down
13 changes: 8 additions & 5 deletions scripts/supportESM.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ function run() {
let newPackageJSON = {};
for (let [field, value] of Object.entries(json)) {
newPackageJSON[field] = value;
if (field === 'main') {
newPackageJSON.exports = {
import: `./${module}`,
require: `./${main}`
};
if (field === 'main' && module) {
newPackageJSON.exports = {};
if (module) {
newPackageJSON.exports.import = `./${module}`;
}
if (main) {
newPackageJSON.exports.require = `./${main}`;
}

if (argv.dryRun) {
console.log('setting main field in ', json.name);
Expand Down

2 comments on commit 1cde05e

@adobe-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adobe-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.