Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename awilix.browser.js to awilix.browser.mjs + more exports conditionals #378

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default [
output: [
{
name: 'Awilix',
file: 'lib/awilix.browser.js',
file: 'lib/awilix.browser.mjs',
format: 'es',
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/rollup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Loading