2.0.0 • Published 12 months ago

vite-plugin-import-intl v2.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

vite-plugin-import-intl

A simple intl globbing import package for Vite

Build Status Code Coverage Issues Open Licenses Bundle Size NPM

Getting started

Install package

npm install -D vite-plugin-import-intl
yarn add -D vite-plugin-import-intl
pnpm add -D vite-plugin-import-intl

Add plugin to vite.config

// vite.config.ts
import importIntl from 'vite-plugin-import-intl'

export default defineConfig({
  plugins: [
    ...,
    importIntl(),
  ],
  ...
})

Add types to tsconfig.json (this provides import.meta.intl intellisense)

// tsconfig.json
{
  "compilerOptions": {
    "types": ["vite-plugin-import-intl/client"],
    ...
  },
}

Usage

To use the plugin, just import a glob of a certain folder, file or array of said locations

// Example
const locales = import.meta.intl('./*.json') // All json files in current folder
const locales = import.meta.intl(['../intl', '../other/intl']) // All json files in the intl and other/intl folder one directory up
2.0.0

12 months ago

1.0.10

12 months ago

1.0.9

12 months ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago