1
0
mirror of https://github.com/tabler/tabler-icons.git synced 2025-01-17 12:48:26 +01:00

mjs extension to esm modules

This commit is contained in:
codecalm 2024-02-28 01:22:32 +01:00
parent 2044b568a7
commit dfac859764
7 changed files with 12 additions and 14 deletions

View File

@ -22,8 +22,10 @@ See the LICENSE file in the root directory of this source tree.`
export const getRollupConfig = (pkg, outputFileName, bundles, globals) => { export const getRollupConfig = (pkg, outputFileName, bundles, globals) => {
return bundles return bundles
.map(({ inputs, format, minify, preserveModules, outputDir = 'dist', extension = 'js' }) => .map(({ inputs, format, minify, preserveModules, outputDir = 'dist', extension = 'js' }) => {
inputs.map(input => ({ console.log(format, extension)
return inputs.map(input => ({
input, input,
plugins: getRollupPlugins(pkg, minify), plugins: getRollupPlugins(pkg, minify),
external: Object.keys(globals), external: Object.keys(globals),
@ -32,6 +34,7 @@ export const getRollupConfig = (pkg, outputFileName, bundles, globals) => {
...(preserveModules ...(preserveModules
? { ? {
dir: `${outputDir}/${format}`, dir: `${outputDir}/${format}`,
entryFileNames: `[name].${extension}`,
} }
: { : {
file: `${outputDir}/${format}/${outputFileName}${minify ? '.min' : ''}.${extension}`, file: `${outputDir}/${format}/${outputFileName}${minify ? '.min' : ''}.${extension}`,
@ -41,7 +44,7 @@ export const getRollupConfig = (pkg, outputFileName, bundles, globals) => {
preserveModules, preserveModules,
globals, globals,
}, },
})), }))
) })
.flat(); .flat();
} }

View File

@ -20,7 +20,7 @@
"amdName": "tabler-icons-preact", "amdName": "tabler-icons-preact",
"main": "dist/cjs/tabler-icons-preact.js", "main": "dist/cjs/tabler-icons-preact.js",
"main:umd": "dist/umd/tabler-icons-preact.js", "main:umd": "dist/umd/tabler-icons-preact.js",
"module": "dist/esm/tabler-icons-preact.js", "module": "dist/esm/tabler-icons-preact.mjs",
"unpkg": "dist/umd/tabler-icons-preact.min.js", "unpkg": "dist/umd/tabler-icons-preact.min.js",
"typings": "dist/tabler-icons-preact.d.ts", "typings": "dist/tabler-icons-preact.d.ts",
"files": [ "files": [

View File

@ -21,7 +21,7 @@
"amdName": "tabler-icons-react-native", "amdName": "tabler-icons-react-native",
"main": "dist/cjs/tabler-icons-react-native.js", "main": "dist/cjs/tabler-icons-react-native.js",
"main:umd": "dist/umd/tabler-icons-react-native.js", "main:umd": "dist/umd/tabler-icons-react-native.js",
"module": "dist/esm/tabler-icons-react-native.js", "module": "dist/esm/tabler-icons-react-native.mjs",
"unpkg": "dist/umd/tabler-icons-react-native.min.js", "unpkg": "dist/umd/tabler-icons-react-native.min.js",
"typings": "dist/tabler-icons-react-native.d.ts", "typings": "dist/tabler-icons-react-native.d.ts",
"react-native": "dist/esm/tabler-icons-react-native.js", "react-native": "dist/esm/tabler-icons-react-native.js",

View File

@ -20,7 +20,7 @@
"type": "module", "type": "module",
"main": "dist/cjs/tabler-icons-react.js", "main": "dist/cjs/tabler-icons-react.js",
"main:umd": "dist/umd/tabler-icons-react.js", "main:umd": "dist/umd/tabler-icons-react.js",
"module": "dist/esm/tabler-icons-react.js", "module": "dist/esm/tabler-icons-react.mjs",
"unpkg": "dist/umd/tabler-icons-react.min.js", "unpkg": "dist/umd/tabler-icons-react.min.js",
"typings": "dist/tabler-icons-react.d.ts", "typings": "dist/tabler-icons-react.d.ts",
"sideEffects": false, "sideEffects": false,

View File

@ -19,7 +19,7 @@
}, },
"source": "src/tabler-icons-solidjs.ts", "source": "src/tabler-icons-solidjs.ts",
"main": "dist/cjs/tabler-icons-solidjs.js", "main": "dist/cjs/tabler-icons-solidjs.js",
"module": "dist/esm/tabler-icons-solidjs.js", "module": "dist/esm/tabler-icons-solidjs.mjs",
"types": "dist/types/tabler-icons-solidjs.d.ts", "types": "dist/types/tabler-icons-solidjs.d.ts",
"files": [ "files": [
"dist" "dist"

View File

@ -20,7 +20,7 @@
"amdName": "tabler-icons-vue", "amdName": "tabler-icons-vue",
"main": "dist/cjs/tabler-icons-vue.js", "main": "dist/cjs/tabler-icons-vue.js",
"main:umd": "dist/umd/tabler-icons-vue.js", "main:umd": "dist/umd/tabler-icons-vue.js",
"module": "dist/esm/tabler-icons-vue.js", "module": "dist/esm/tabler-icons-vue.mjs",
"unpkg": "dist/umd/tabler-icons-vue.min.js", "unpkg": "dist/umd/tabler-icons-vue.min.js",
"typings": "dist/tabler-icons-vue.d.ts", "typings": "dist/tabler-icons-vue.d.ts",
"sideEffects": false, "sideEffects": false,

View File

@ -8,16 +8,11 @@
"type": "git", "type": "git",
"url": "git+https://github.com/tabler/tabler-icons.git" "url": "git+https://github.com/tabler/tabler-icons.git"
}, },
"main": "dist/cjs/tabler-icons.js",
"main:umd": "dist/umd/tabler-icons.js",
"exports": { "exports": {
"./*": [ "./*": [
"./icons/*" "./icons/*"
] ]
}, },
"module": "dist/esm/tabler-icons.js",
"unpkg": "dist/umd/tabler-icons.min.js",
"typings": "dist/tabler-icons.d.ts",
"sideEffects": false, "sideEffects": false,
"files": [ "files": [
"icons.json", "icons.json",