fix(package) add esm node version + move web to separate export

This commit is contained in:
sati.ac 2023-07-26 06:21:05 +03:00
parent a6df96fd90
commit 9b86c7186a
2 changed files with 25 additions and 4 deletions

@ -1,6 +1,6 @@
{ {
"name": "sati", "name": "sati",
"version": "0.2.1", "version": "0.2.2",
"description": "next generation anti-captcha", "description": "next generation anti-captcha",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
@ -37,9 +37,14 @@
"types": "./dist/src/index.d.ts", "types": "./dist/src/index.d.ts",
"exports": { "exports": {
".": { ".": {
"import": "dist/sati.web.esm.mjs", "import": "./dist/sati.node.esm.js",
"require": "dist/sati.web.umd.js", "require": "./dist/sati.node.cjs.js",
"types": "dist/src/index.d.ts" "types": "./dist/src/index.d.ts"
},
"web": {
"import": "./dist/sati.web.esm.js",
"require": "./dist/sati.web.umd.js",
"types": "./dist/src/index.d.ts"
} }
} }
} }

@ -64,4 +64,20 @@ module.exports = [{
optimization: { optimization: {
minimize: false minimize: false
} }
}, {
// prebuilt node esm version
...build('node'),
output: {
library: {
type: 'module'
},
filename: 'sati.node.esm.mjs'
},
externals: /^[^\.%]/,
optimization: {
minimize: false
},
experiments: {
outputModule: true
}
}] }]