Skip to content

Commit

Permalink
[fix][NPM] Add package.json to exports
Browse files Browse the repository at this point in the history
Update package.json exports to include package.json. Why package.json
needs to export itself, I cannot say but it fixes the following Svelte
rollup.js plugin warning:

  [rollup-plugin-svelte] The following packages did not export their `package.json` file so we could not check the "svelte" field. If you had difficulties importing svelte components from a package, then please contact the author and ask them to export the package.json file.

  - browser-fs-access

I've verified locally using `npm link` that the warning no longer occurs
with this change in my Svelte project. I _believe_ the otherwise
preexisting exports behavior is preserved.

References:
- [Official documentation](https://nodejs.org/api/packages.html#packages_exports) and [much more useful documentation with examples from the proposal](https://github.com/jkrems/proposal-pkg-exports)
- [Similar issue for a different package](sveltejs/svelte#5659) and [its resolution](https://unpkg.com/svelte@3.29.6/package.json)
  • Loading branch information
niedzielski committed Jun 6, 2021
1 parent 31995c7 commit 8c67d29
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"description": "File System Access API with legacy fallback in the browser.",
"browser": "./dist/index.js",
"main": "./dist/index.js",
"exports": "./dist/index.js",
"exports": {
".": "./dist/index.js",
"./package.json": "./package.json"
},
"module": "./dist/index.js",
"types": "./index.d.ts",
"scripts": {
Expand Down

0 comments on commit 8c67d29

Please sign in to comment.