mirror of
https://github.com/AtHeartEngineer/rlnjs.git
synced 2026-01-08 20:47:55 -05:00
feat(README.md): update package.json to better handle module resolution
- Replace "exports" field with "main", "module", and "browser" fields - Ensure Node.js environment uses index.node.js - Direct build tools supporting ES modules to use index.mjs - Specify browser environment to replace index.node.js with index.mjs This change improves module resolution across different environments and build tools, addressing potential issues with server-side and client-side execution in Next.js projects.
This commit is contained in:
@@ -42,11 +42,11 @@
|
||||
"access": "public"
|
||||
},
|
||||
"main": "./dist/index.node.js",
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.node.js"
|
||||
"module": "./dist/index.mjs",
|
||||
"browser": {
|
||||
"./dist/index.node.js": "./dist/index.mjs"
|
||||
},
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"directories": {
|
||||
"dist": "./dist",
|
||||
"src": "./src",
|
||||
|
||||
@@ -69,7 +69,7 @@ export default [
|
||||
// Node.js build
|
||||
{
|
||||
input,
|
||||
output: { file: pkg.exports.require, format: 'cjs', banner },
|
||||
output: { file: pkg.main, format: 'cjs', banner },
|
||||
external: Object.keys(pkg.dependencies),
|
||||
plugins: [
|
||||
cleaner({
|
||||
@@ -84,7 +84,7 @@ export default [
|
||||
// Browser build
|
||||
{
|
||||
input,
|
||||
output: { file: pkg.exports.import, format: 'es', banner },
|
||||
output: { file: pkg.module, format: 'es', banner },
|
||||
plugins: [
|
||||
...browserPlugins,
|
||||
visualizerPlugin,
|
||||
|
||||
Reference in New Issue
Block a user