wasm-pack
wasm-pack copied to clipboard
Consider not using the "files" key in package.json
From https://github.com/rustwasm/wasm-pack/pull/556
Larger picture / for the future: rather than writing code to try and include all of our files, which can be buggy as we've seen multiple times now, it would easier to implicitly include everything in the
pkgfolder by not specifying the"files"key inpackage.json, since we don't put anything in there that we don't want included in the package anyways.
Wen I was experimenting with the generated package.json to try to find a workaround to #663, I found that the .gitignore that is generated is also interpreted by npm as an implicit file exclusion list. Removing the "files" key entirely results in the archive only containing the README and license files.
after discussion in the the rustwasm meeting last week, we've opted to continue using the files key but to populate it with the set of the files found in pkg/ at time of calling wasm-pack publish.
Any progress here? It looks important becase it prevents inline snippets (which is a very cool feature itself) from being published by default. The workaround is to rm pkg/.gitignore pkg/package.json and to provide your own package.json
Any progress here?
I am using this workaround to add additional files to be published, after wasm-pack build:
jq '.files += ["somefile.js"]' pkg/package.json > tmp.json && mv tmp.json pkg/package.json
Built-in support for adding custom files would be great!