Ship @tabler/core as ESM only, drop the UMD bundle (#2983)

This commit is contained in:
Bartosz-Do authored and Bartek committed 2026-10-02 12:03:12 +02:00
1 parent f98f27228d
commit d0ddf0a96f
12 files changed
+69 -48

No files matched your search

+3 -5
View File
@@ -18,11 +18,9 @@ const entry = `${entryPath}.ts`
export default createViteConfig({
entry: entry,
name: libraryName,
fileName: (format) => {
const esmSuffix = format === 'es' ? '.esm' : ''
return `${baseName}${esmSuffix}.js`
},
formats: ['es', 'umd'],
// ESM only (Tabler 2.0, like Bootstrap v6): one artifact per entry, no `.esm` suffix.
fileName: () => `${baseName}.js`,
formats: ['es'],
outDir: path.resolve(__dirname, '../dist/js'),
banner: bannerText,
minify: false,
+4 -3
View File
@@ -39,7 +39,7 @@ All files in the package are also available over a CDN:
```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/core@latest/dist/css/tabler.min.css" />
<script src="https://cdn.jsdelivr.net/npm/@tabler/core@latest/dist/js/tabler.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@tabler/core@latest/dist/js/tabler.min.js"></script>
```
If you don't use a package manager, [download the latest release](https://github.com/tabler/tabler/releases) as a ZIP archive.
@@ -55,7 +55,8 @@ import '@tabler/core/dist/css/tabler.min.css'
import '@tabler/core/dist/js/tabler.min.js'
```
There's also an ES module build with named exports, which is handy when you create components from code:
The bundle is ESM only — in a plain HTML page load it with `<script type="module">`. It also has
named exports, which is handy when you create components from code:
```js
import { Tooltip } from '@tabler/core'
@@ -104,7 +105,7 @@ The third-party libraries used by the demo pages (ApexCharts, Tom Select, Vanill
@tabler/core/
├── dist/
│ ├── css/ tabler.css and the optional stylesheets, each with .min and .rtl versions
│ ├── js/ tabler.js and tabler.esm.js, plus the standalone tabler-theme.js
│ ├── js/ tabler.js (ESM, load with <script type="module">), plus the standalone tabler-theme.js
│ ├── libs/ bundled third-party plugins
│ ├── types/ TypeScript declarations
│ ├── fonts/
+2 -2
View File
@@ -32,5 +32,5 @@ export { default as Sparkline } from './src/sparkline'
export { default as Strength } from './src/strength'
export { default as SwitchIcon } from './src/switch-icon'
// deprecated(2.0): the `tabler` namespace with `getColor()`, `hexToRgba()` and `prefix`
export * as tabler from './src/deprecated'
// Tabler's own helpers as named exports (prefix, hexToRgba, getColor)
export * from './src/tabler'
+24 -21
View File
@@ -3,6 +3,7 @@
"version": "1.6.1",
"description": "Premium and Open Source dashboard template with responsive and high quality UI.",
"homepage": "https://tabler.io",
"type": "module",
"scripts": {
"dev": "pnpm run watch",
"dev:prepare": "pnpm run clean && pnpm run copy && concurrently \"pnpm run css:dev\" \"pnpm run js:build\"",
@@ -21,8 +22,8 @@
"js:build:theme": "cross-env BASE_NAME=tabler-theme vite build --config .build/vite.config.mts",
"js:build:standalone": "cross-env BASE_NAME=tabler vite build --config .build/vite.config.mts",
"js:min": "concurrently \"pnpm run js:min:standalone\" \"pnpm run js:min:theme\"",
"js:min:standalone": "concurrently \"terser dist/js/tabler.js --compress passes=2,ecma=2020 --ecma 2020 --mangle --source-map \\\"content=dist/js/tabler.js.map,filename=dist/js/tabler.min.js.map,url=tabler.min.js.map\\\" -o dist/js/tabler.min.js\" \"terser dist/js/tabler.esm.js --module --compress passes=2,ecma=2020 --ecma 2020 --mangle --source-map \\\"content=dist/js/tabler.esm.js.map,filename=dist/js/tabler.esm.min.js.map,url=tabler.esm.min.js.map\\\" -o dist/js/tabler.esm.min.js\"",
"js:min:theme": "concurrently \"terser dist/js/tabler-theme.js --compress passes=2,ecma=2020 --ecma 2020 --mangle --source-map \\\"content=dist/js/tabler-theme.js.map,filename=dist/js/tabler-theme.min.js.map,url=tabler-theme.min.js.map\\\" -o dist/js/tabler-theme.min.js\" \"terser dist/js/tabler-theme.esm.js --module --compress passes=2,ecma=2020 --ecma 2020 --mangle --source-map \\\"content=dist/js/tabler-theme.esm.js.map,filename=dist/js/tabler-theme.esm.min.js.map,url=tabler-theme.esm.min.js.map\\\" -o dist/js/tabler-theme.esm.min.js\"",
"js:min:standalone": "terser dist/js/tabler.js --module --compress passes=2,ecma=2020 --ecma 2020 --mangle --source-map \"content=dist/js/tabler.js.map,filename=dist/js/tabler.min.js.map,url=tabler.min.js.map\" -o dist/js/tabler.min.js",
"js:min:theme": "terser dist/js/tabler-theme.js --module --compress passes=2,ecma=2020 --ecma 2020 --mangle --source-map \"content=dist/js/tabler-theme.js.map,filename=dist/js/tabler-theme.min.js.map,url=tabler-theme.min.js.map\" -o dist/js/tabler-theme.min.js",
"copy": "concurrently \"pnpm run copy:img\" \"pnpm run copy:libs\"",
"copy:img": "tsx .build/copy-img.ts",
"copy:libs": "tsx .build/copy-libs.ts",
@@ -75,11 +76,29 @@
],
"style": "dist/css/tabler.css",
"sass": "scss/tabler.scss",
"unpkg": "dist/js/tabler.min.js",
"umd:main": "dist/js/tabler.min.js",
"module": "dist/js/tabler.esm.js",
"main": "dist/js/tabler.js",
"module": "dist/js/tabler.js",
"types": "dist/types/tabler.d.ts",
"unpkg": "dist/js/tabler.min.js",
"jsdelivr": "dist/js/tabler.min.js",
"sideEffects": [
"./js/**",
"./dist/js/tabler.js",
"./dist/js/tabler-theme.js"
],
"exports": {
".": {
"types": "./dist/types/tabler.d.ts",
"import": "./dist/js/tabler.js"
},
"./theme": "./dist/js/tabler-theme.js",
"./package.json": "./package.json",
"./libs.json": "./libs.json",
"./scss/*": "./scss/*",
"./js/*.ts": "./js/*.ts",
"./js/*": "./js/*.ts",
"./dist/*": "./dist/*"
},
"bundlewatch": {
"files": [
{
@@ -218,29 +237,13 @@
"path": "./dist/js/tabler.min.js",
"maxSize": "40 kB"
},
{
"path": "./dist/js/tabler.esm.js",
"maxSize": "58 kB"
},
{
"path": "./dist/js/tabler.esm.min.js",
"maxSize": "40 kB"
},
{
"path": "./dist/js/tabler-theme.js",
"maxSize": "1.3 kB"
},
{
"path": "./dist/js/tabler-theme.esm.js",
"maxSize": "1.3 kB"
},
{
"path": "./dist/js/tabler-theme.min.js",
"maxSize": "800 B"
},
{
"path": "./dist/js/tabler-theme.esm.min.js",
"maxSize": "800 B"
}
]
},