nitro icon indicating copy to clipboard operation
nitro copied to clipboard

useStorage seems not working

Open RahulDey12 opened this issue 1 month ago • 1 comments

Environment

Nitro: 2.12.9 node: v24.11.0

Reproduction

https://github.com/RahulDey12/nitro-check please clone and run it's just a single route.

Describe the bug

just created a new project, trying to import useStorage but not working

Additional context

No response

Logs


RahulDey12 avatar Nov 04 '25 21:11 RahulDey12

It's because you disabled the auto-imports feature with imports: false in nitro.config.ts. In this case, you should import explicitly with import { useStorage } from 'nitropack/runtime'.

kricsleo avatar Nov 08 '25 13:11 kricsleo

Okay thanks. It works now. For the new project template, it should be removed, I think.

RahulDey12 avatar Nov 08 '25 15:11 RahulDey12

For the new project template, it should be removed

Do you mean Nitro's starter template (v2)? I didn't see the useStorage usage in this template.

As for the default imports: false, please refer to Depend less on auto imports

kricsleo avatar Nov 08 '25 17:11 kricsleo

Got it

RahulDey12 avatar Nov 10 '25 13:11 RahulDey12