1
0
mirror of https://github.com/tabler/tabler.git synced 2026-07-14 09:34:19 +04:00

refactor: migrate build system from Rollup to Vite (#2578)

This commit is contained in:
Paweł Kuna
2026-01-06 00:26:42 +01:00
committed by GitHub
parent ee8875deb6
commit 48dbd1ed1b
13 changed files with 495 additions and 688 deletions
-41
View File
@@ -1,41 +0,0 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { babel } from '@rollup/plugin-babel'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import replace from '@rollup/plugin-replace'
import banner from '../../shared/banner/index.mjs'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const external = []
const plugins = [
babel({
exclude: 'node_modules/**',
babelHelpers: 'bundled'
})
]
plugins.push(
replace({
'process.env.NODE_ENV': '"production"',
preventAssignment: true
}),
nodeResolve()
)
const rollupConfig = {
input: [
path.resolve(__dirname, `../js/demo.js`)
],
output: {
name: 'demo',
banner: banner('Demo'),
dir: path.resolve(__dirname, `../dist/preview/js`),
format: 'esm',
generatedCode: 'es2015'
},
external,
plugins
}
export default rollupConfig
+18
View File
@@ -0,0 +1,18 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { createViteConfig } from '../../.build/vite.config.helper.mjs'
import getBanner from '../../shared/banner/index.mjs'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const bannerText = getBanner('Demo')
export default createViteConfig({
entry: path.resolve(__dirname, '../js/demo.js'),
name: 'demo',
fileName: () => 'demo.js',
formats: ['es'],
outDir: path.resolve(__dirname, '../dist/preview/js'),
banner: bannerText
})
+1 -1
View File
@@ -15,7 +15,7 @@
"css-prefix": "postcss --config .build/postcss.config.mjs --replace \"dist/preview/css/*.css\" \"!dist/preview/css/*.rtl*.css\" \"!dist/preview/css/*.min.css\"",
"css-minify": "cleancss -O1 --format breakWith=lf --with-rebase --source-map --source-map-inline-sources --output dist/preview/css/ --batch --batch-suffix \".min\" \"dist/preview/css/*.css\" \"!dist/preview/css/*.min.css\" \"!dist/preview/css/*rtl*.css\"",
"js": "pnpm run js-compile && pnpm run js-minify",
"js-compile": "rollup --config .build/rollup.config.mjs --sourcemap",
"js-compile": "vite build --config .build/vite.config.mjs",
"js-minify": "pnpm run js-minify-demo",
"js-minify-demo": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/preview/js/demo.js.map,includeSources,url=demo.min.js.map\" --output dist/preview/js/demo.min.js dist/preview/js/demo.js",
"clean": "shx rm -rf dist demo",