You might be surprised why in the documentation there are no import statements.
This is because Nitro is integrated with unjs/unimport and automatically imports utilities by usage with full tree-shaking support!
Check the source code for list of available auto imports.
With TypeScript enabled, you can easily see them as global utilities in your IDE.
npx nitropack prepare
to generate the types for global auto-imports.For some edge cases (IDE support and libraries in node_modules
) it is impossible to rely on auto imports.
You can import them from virtual #imports
file. It will be still tree-shaken:
import { useStorage } from '#imports'