Skip to content

Commit

Permalink
🚀 feat(package): improve ESM support and type declarations (v2.0.3)
Browse files Browse the repository at this point in the history
- Update exports field in package.json for better ESM and types support
- Add sideEffects field to package.json
- Update build script to generate declaration files
- Add Node.js engine requirement for ESM compatibility
- Adjust tsconfig.json to emit declaration files
  • Loading branch information
Arakiss committed Aug 26, 2024
1 parent 9de1fb2 commit 061d824
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ out
# Nuxt.js build / generate output

.nuxt
dist

# Gatsby files

Expand Down Expand Up @@ -173,3 +172,5 @@ dist

# Finder (MacOS) folder config
.DS_Store

dist
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ logger.warn('This is a warning', { additionalInfo: 'Some extra data' });
logger.error('An error occurred', { errorCode: 500 });
```

Note: The default export is an instance of the ConfigurableLogger class, pre-configured for the detected environment.

### Output Example

Server environment:
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "nexlog",
"version": "2.0.2",
"version": "2.0.3",
"description": "A simple and effective logging library for Next.js, compatible with server, browser, and edge environments.",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"react": "dist/react/LoggerProvider.js",
"react": "dist/react/logger-provider.js",
"sideEffects": false,
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./react": {
"import": "./dist/react/LoggerProvider.js",
"types": "./dist/react/LoggerProvider.d.ts"
"import": "./dist/react/logger-provider.js",
"types": "./dist/react/logger-provider.d.ts"
}
},
"files": ["dist"],
Expand Down

0 comments on commit 061d824

Please sign in to comment.