CLI Tool
nuxt-loaders comes with a built-in CLI tool to help you manage your loaders.
Usage
The CLI is available via the loaders command.
Bash
npx loaders <command> [options]
Commands
add
Adds a new loader to your project.
Bash
npx loaders add <loader-name>
This command will:
- Fetch the loader component from the remote template store.
- Save it to your configured
loadersDir(default:app/components/loaders). - Update
loaders.config.jsonto track the installed loader.
Example:
Bash
npx loaders add basic
remove
Removes an installed loader from your project.
Bash
npx loaders remove <loader-name>
This command will:
- Delete the loader component file from your
loadersDir. - Remove the entry from
loaders.config.json.
Example:
Bash
npx loaders remove basic
Troubleshooting
- "Not a Nuxt project": Ensure you are running the command from the root of your Nuxt project.
- "Could not find loaders config": Make sure you have added the module to your
nuxt.config.tsand runnuxi prepareor started the dev server at least once to generate theloaders.config.jsonfile.
