This content is in progress and is expected to continue to evolve.

Notes

  • When using a dist directory, it may be ignored when you go to publish. You can run npm publish --dry-run to test which files are included.
    • The .gitignore is generally respected as a default.
    • If you use the files: [] option in package.json, you may specify the dist directory there.
    • If you specify the main property as dist/index.js, then it will include the whole directory even without a files: [].
  • The main property supports “old node”.
    • It seems that webpack4 does not use this in file resolution, but webpack5 does. This means if publishing with a dist folder with "main": "dist" then import { invoke } from "@tauri-apps/api/tauri" won’t work in webpack4 but import { invoke } from "@tauri-apps/api/dist/tauri" will work for a scoped package called @tauri-apps/api.

Links

General

JavaScript

TypeScript

https://twitter.com/\_developit/status/1347306689264033795 https://github.com/microsoft/TypeScript/issues/33079