Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rowellx68/esbuild-plugin-i18next-loader
An esbuild plugin to client bundle i18next locales
https://github.com/rowellx68/esbuild-plugin-i18next-loader
Last synced: 2 days ago
JSON representation
An esbuild plugin to client bundle i18next locales
- Host: GitHub
- URL: https://github.com/rowellx68/esbuild-plugin-i18next-loader
- Owner: rowellx68
- License: mit
- Created: 2023-12-14T22:39:35.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-21T10:39:01.000Z (8 months ago)
- Last Synced: 2024-12-06T22:21:10.026Z (21 days ago)
- Language: TypeScript
- Size: 363 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
![MIT](https://img.shields.io/badge/License-MIT-green?style=flat-square)
![Version](https://img.shields.io/github/package-json/v/rowellx68/esbuild-plugin-i18next-loader?style=flat-square)
![CI](https://img.shields.io/github/actions/workflow/status/rowellx68/esbuild-plugin-i18next-loader/publish.yml?style=flat-square)# `esbuild-plugin-i18next-loader`
esbuild plugin to client bundle i18next locales.
This plugin generates a virtual module that contains all the locales that are available in the project.
It is a rewrite of [alienfast/vite-plugin-i18next-loader](https://github.com/alienfast/vite-plugin-i18next-loader) to work with esbuild.
## Install
```bash
npm install --save-dev esbuild-plugin-i18next-loader# or
pnpm add -D esbuild-plugin-i18next-loader# or
yarn add -D esbuild-plugin-i18next-loader
```## Options
| Name | Type | Default | Description |
| --------------------- | ---------------------------------------------- | ---------------------------------------- | ----------------------------------------------- |
| `include` | `('**/*.json' \| '**/*.yml' \| '**/*.yaml')[]` | `['**/*.json', '**/*.yml', '**/*.yaml']` | Glob patterns of files to include for bundling. |
| `namespaceResolution` | `basename`, `relativePath` | none | Namespace resolution strategy. |
| `paths` | `string[]` | `[]` | Locale top-level directory paths. |## Usage with esbuild
```js
import { i18nextPlugin } from "esbuild-plugin-i18next-loader";await esbuild.build({
entryPoints: ["./src/index.ts"],
write: true,
bundle: true,
plugins: [
i18nextPlugin({
namespaceResolution: "basename",
paths: ["./src/**/locales"],
}),
],
});
```## LICENSE
MIT