-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: when data array is null it shouldn't throw
- fix null data error thrown & couple of other fixes
- Loading branch information
1 parent
d3147eb
commit 184dffa
Showing
10 changed files
with
469 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
tsconfig.json | ||
tsconfig.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { defineConfig } from 'vite'; | ||
import { resolve } from 'path'; | ||
import path from 'node:path'; | ||
import glob from 'glob'; | ||
|
||
const dirname = path.dirname(__filename); | ||
const localeFiles: string[] = glob.sync('src/locales/**/*.ts'); | ||
const localeEntryPoints: string[] = []; | ||
const locales: string[] = [resolve(dirname, `src/locales/all-locales-index.ts`)]; | ||
const localeInputs: { [locale: string]: string } = { | ||
all: resolve(dirname, `src/locales/all-locales-index.ts`), | ||
}; | ||
|
||
for (const localeFile of localeFiles) { | ||
// eslint-disable-next-line no-unused-vars | ||
const [_, locale] = localeFile.match(/multiple-select-(.*)\.ts$/) || []; | ||
if (locale && locale.length === 5) { | ||
// locales.push(locale); | ||
localeInputs[locale] = resolve(dirname, `src/locales/multiple-select-${locale}.ts`); | ||
localeEntryPoints.push(resolve(dirname, `src/locales/multiple-select-${locale}.ts`)); | ||
} | ||
} | ||
|
||
export default defineConfig({ | ||
base: './', | ||
mode: 'library', | ||
build: { | ||
emptyOutDir: false, | ||
minify: true, | ||
sourcemap: false, | ||
lib: { | ||
entry: locales.map((locale) => resolve(dirname, `src/locales/multiple-select-${locale}.ts`)), | ||
// entry: [ | ||
// resolve(dirname, 'src/locales/multiple-select-en-US.ts'), | ||
// resolve(dirname, 'src/locales/multiple-select-es-ES.ts'), | ||
// ], | ||
formats: ['es', 'cjs'], | ||
// name: 'multiple-select-all-locales', | ||
// fileName: ' multiple-select-all-locales', | ||
fileName: (format, entryName) => { | ||
if (entryName === 'all') { | ||
return `multiple-select-all-locales.${format === 'cjs' ? 'cjs' : 'js'}`; | ||
} | ||
return `locales/multiple-select-${entryName}.${format === 'cjs' ? 'cjs' : 'js'}`; | ||
}, | ||
}, | ||
rollupOptions: { | ||
input: localeInputs, | ||
// input: { | ||
// // inlineDynamicImports: false, | ||
// // all: resolve(dirname, 'src/locales/all-locales-index.ts'), | ||
// 'en-US': resolve(dirname, 'src/locales/multiple-select-en-US.ts'), | ||
// 'es-ES': resolve(dirname, 'src/locales/multiple-select-es-ES.ts'), | ||
// }, | ||
// output: [ | ||
// { | ||
// format: 'umd', | ||
// name: '[name]', | ||
// inlineDynamicImports: true, | ||
// entryFileNames: '[name].bundle.[format].js', | ||
// // entryFileNames: 'multiple-select.[format].js', | ||
// }, | ||
// ], | ||
}, | ||
}, | ||
}); |
Oops, something went wrong.