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

Refresh export structure in package.json #693

Open
Acconut opened this issue May 28, 2024 · 0 comments
Open

Refresh export structure in package.json #693

Acconut opened this issue May 28, 2024 · 0 comments

Comments

@Acconut
Copy link
Member

Acconut commented May 28, 2024

Currently, tus-js-client uses the outdated main, module, and browser fields to indicate what files users should access when the package is imported:

"main": "lib.es5/node/index.js",
"module": "lib.esm/node/index.js",
"files": ["lib/**/*", "lib.es5/**/*", "lib.esm/**/*", "dist/**/*", "lib/index.d.ts"],
"browser": {
"./lib.es5/node/index.js": "./lib.es5/browser/index.js",
"./lib.esm/node/index.js": "./lib.esm/browser/index.js",
"./lib/node/index.js": "./lib/browser/index.js"
},
"types": "./lib/index.d.ts",

After #683 is completed, we should upgrade this to more recent syntax that also incorporates the exports syntax. Resources:

The benefit is that tool can either resolve to the CommonJS or ESM variants of tus-js-client. We can also consider exporting different types for browser and Node.js environments, as well as making environment-specific imports possible (e.g. import ... from 'tus-js-client/react-native/fileReader'). Resources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant