docs: update references to lodash and recommend es-toolkit

This commit is contained in:
Daniel Roe 2024-12-29 23:09:42 +00:00
parent 100eaa348d
commit e70ef00e55
No known key found for this signature in database
GPG Key ID: CBC814C393D93268
2 changed files with 3 additions and 9 deletions

View File

@ -638,11 +638,11 @@ We have raised PRs to update modules using EJS syntax, but if you need to do thi
* Moving your string interpolation logic directly into `getContents()`. * Moving your string interpolation logic directly into `getContents()`.
* Using a custom function to handle the replacement, such as in https://github.com/nuxt-modules/color-mode/pull/240. * Using a custom function to handle the replacement, such as in https://github.com/nuxt-modules/color-mode/pull/240.
* Continuing to use `lodash`, as a dependency of _your_ project rather than Nuxt: * Use `es-toolkit/compat` (a drop-in replacement for lodash template), as a dependency of _your_ project rather than Nuxt:
```diff ```diff
+ import { readFileSync } from 'node:fs' + import { readFileSync } from 'node:fs'
+ import { template } from 'lodash-es' + import { template } from 'es-toolkit/compat'
// ... // ...
addTemplate({ addTemplate({
fileName: 'appinsights-vue.js' fileName: 'appinsights-vue.js'

View File

@ -85,20 +85,14 @@ export default defineUntypedSchema({
}, },
/** /**
* You can provide your own templates which will be rendered based * It is recommended to use `addTemplate` from `@nuxt/kit` instead of this option.
* on Nuxt configuration. This feature is specially useful for using with modules.
* *
* Templates are rendered using [`lodash/template`](https://lodash.com/docs/4.17.15#template).
* @example * @example
* ```js * ```js
* templates: [ * templates: [
* { * {
* src: '~/modules/support/plugin.js', // `src` can be absolute or relative * src: '~/modules/support/plugin.js', // `src` can be absolute or relative
* dst: 'support.js', // `dst` is relative to project `.nuxt` dir * dst: 'support.js', // `dst` is relative to project `.nuxt` dir
* options: {
* // Options are provided to template as `options` key
* live_chat: false
* }
* } * }
* ] * ]
* ``` * ```