diff --git a/package.json b/package.json index d5e1cd2..7ce2ad7 100644 --- a/package.json +++ b/package.json @@ -5,11 +5,10 @@ "author": "Wowser Contributors", "repository": "github:wowserhq/scene", "license": "MIT", - "main": "./dist/cjs/index.js", + "type": "module", "module": "./dist/esm/index.js", "types": "./dist/types/index.d.ts", "exports": { - "require": "./dist/cjs/index.js", "import": "./dist/esm/index.js", "types": "./dist/types/index.d.ts" }, @@ -17,12 +16,10 @@ "dist" ], "scripts": { - "build": "npm run clean && npm run test && npm run build:cjs && npm run build:esm && npm run build:types && npm run build:package", - "build:cjs": "tsc --module commonjs --moduleResolution node --outDir ./dist/cjs", - "build:esm": "tsc --module es2022 --outDir ./dist/esm", - "build:types": "tsc --module es2022 --emitDeclarationOnly --declaration --declarationDir ./dist/types", - "build:package": "node ./script/build-package.js", - "clean": "node ./script/clean.js", + "build": "npm run clean && npm run test && npm run build:esm && npm run build:types", + "build:esm": "tsc --outDir ./dist/esm", + "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir ./dist/types", + "clean": "node ./script/clean.mjs", "format": "prettier ./src/**/* --write", "lint": "eslint --ignore-path .gitignore", "lint:commit": "commitlint --edit", diff --git a/script/build-package.js b/script/build-package.js deleted file mode 100644 index 4de5b60..0000000 --- a/script/build-package.js +++ /dev/null @@ -1,12 +0,0 @@ -const fs = require('fs-extra'); - -const cjsPackage = { - type: 'commonjs', -}; - -const esmPackage = { - type: 'module', -}; - -fs.writeJsonSync('./dist/cjs/package.json', cjsPackage); -fs.writeJsonSync('./dist/esm/package.json', esmPackage); diff --git a/script/clean.js b/script/clean.js deleted file mode 100644 index f73ffa2..0000000 --- a/script/clean.js +++ /dev/null @@ -1,3 +0,0 @@ -const fs = require('fs-extra'); - -fs.removeSync('./dist'); diff --git a/script/clean.mjs b/script/clean.mjs new file mode 100644 index 0000000..c4adc3d --- /dev/null +++ b/script/clean.mjs @@ -0,0 +1,3 @@ +import fs from 'fs-extra'; + +fs.removeSync('./dist'); diff --git a/tsconfig.json b/tsconfig.json index 57bed7f..cf3886f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,9 +2,9 @@ "include": ["./src/lib/**/*"], "compilerOptions": { "target": "es2022", - "allowJs": true, + "module": "node16", + "skipLibCheck": true, "sourceMap": true, - "esModuleInterop": true, - "moduleResolution": "node" + "esModuleInterop": true } }