diff --git a/README.md b/README.md index a175a2f..c0ad116 100644 --- a/README.md +++ b/README.md @@ -1384,7 +1384,7 @@ The package includes 4 flavors. - CommonJS, the good ol' Node format - `lib/awilix.js` - ES Modules, for use with module bundlers **in Node** - `lib/awilix.module.mjs` - ES Modules, for use with module bundlers **in the browser** - - `lib/awilix.browser.js` + `lib/awilix.browser.mjs` - UMD, for dropping it into a script tag - `lib/awilix.umd.js` The `package.json` includes the proper fields for bundlers like Webpack, Rollup diff --git a/package.json b/package.json index 1783e34..bc78645 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "main": "lib/awilix.js", "module": "lib/awilix.module.mjs", "jsnext:main": "lib/awilix.module.mjs", - "browser": "lib/awilix.browser.js", + "browser": "lib/awilix.browser.mjs", "umd:main": "lib/awilix.umd.js", - "react-native": "lib/awilix.browser.js", + "react-native": "lib/awilix.browser.mjs", "typings": "lib/awilix.d.ts", "engines": { "node": ">=16.3.0" @@ -16,12 +16,19 @@ ".": { "import": "./lib/awilix.module.mjs", "types": "./lib/awilix.d.ts", + "workerd": "./lib/awilix.browser.mjs", + "browser": { + "import": "./lib/awilix.browser.mjs", + "default": "./lib/awilix.umd.js" + }, "default": "./lib/awilix.js" }, "./browser": { - "import": "./lib/awilix.browser.js", + "import": "./lib/awilix.browser.mjs", "types": "./lib/awilix.d.ts", - "default": "./lib/awilix.browser.js" + "workerd": "./lib/awilix.browser.mjs", + "browser": "./lib/awilix.browser.mjs", + "default": "./lib/awilix.umd.js" }, "./lib/*.js": { "types": "./lib/*.d.ts", @@ -39,7 +46,7 @@ "cover": "npm run test -- --coverage", "publish:pre": "npm run lint && npm run build && npm run cover", "publish:post": "npm publish && git push --follow-tags", - "release:prerelease": "npm run publish:pre && npm version prerelease && npm run publish:post", + "release:prerelease": "npm run publish:pre && npm version prerelease --preid alpha && npm run publish:post", "release:patch": "npm run publish:pre && npm version patch && npm run publish:post", "release:minor": "npm run publish:pre && npm version minor && npm run publish:post", "release:major": "npm run publish:pre && npm version major && npm run publish:post", diff --git a/rollup.config.mjs b/rollup.config.mjs index d17d61b..5db2b2e 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -58,7 +58,7 @@ export default [ output: [ { name: 'Awilix', - file: 'lib/awilix.browser.js', + file: 'lib/awilix.browser.mjs', format: 'es', }, { diff --git a/src/__tests__/rollup.test.ts b/src/__tests__/rollup.test.ts index 929945b..891bca3 100644 --- a/src/__tests__/rollup.test.ts +++ b/src/__tests__/rollup.test.ts @@ -4,7 +4,7 @@ const cjs = require('../../lib/awilix') // @ts-ignore import * as es from '../../lib/awilix.module.mjs' const umd = require('../../lib/awilix.umd') -const browser = require('../../lib/awilix.browser') +const browser = require('../../lib/awilix.browser.mjs') describe('rollup artifacts', () => { it('works', () => {