mirror of
https://github.com/tabler/tabler.git
synced 2026-01-25 04:16:36 +00:00
refactor: migrate build system from Rollup to Vite (#2578)
This commit is contained in:
@@ -1,40 +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 dotenv from "rollup-plugin-dotenv"
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
const external = []
|
||||
const plugins = [
|
||||
dotenv({
|
||||
cwd: path.resolve(__dirname, '../..'),
|
||||
}),
|
||||
babel({
|
||||
exclude: 'node_modules/**',
|
||||
babelHelpers: 'bundled'
|
||||
}),
|
||||
replace({
|
||||
'process.env.NODE_ENV': '"production"',
|
||||
preventAssignment: true
|
||||
}),
|
||||
nodeResolve()
|
||||
]
|
||||
|
||||
const rollupConfig = {
|
||||
input: [
|
||||
path.resolve(__dirname, `../js/docs.js`)
|
||||
],
|
||||
output: {
|
||||
name: 'docs',
|
||||
dir: path.resolve(__dirname, `../dist/js`),
|
||||
format: 'esm',
|
||||
generatedCode: 'es2015'
|
||||
},
|
||||
external,
|
||||
plugins
|
||||
}
|
||||
|
||||
export default rollupConfig
|
||||
15
docs/.build/vite.config.mjs
Normal file
15
docs/.build/vite.config.mjs
Normal file
@@ -0,0 +1,15 @@
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { createViteConfig } from '../../.build/vite.config.helper.mjs'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
export default createViteConfig({
|
||||
entry: path.resolve(__dirname, '../js/docs.js'),
|
||||
name: 'docs',
|
||||
fileName: () => 'docs.js',
|
||||
formats: ['es'],
|
||||
outDir: path.resolve(__dirname, '../dist/js'),
|
||||
banner: undefined
|
||||
})
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"build-assets": "concurrently \"pnpm run js\" \"pnpm run css\"",
|
||||
"html": "eleventy",
|
||||
"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-docs",
|
||||
"js-minify-docs": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/docs.js.map,includeSources,url=docs.min.js.map\" --output dist/js/docs.min.js dist/js/docs.js",
|
||||
"css": "pnpm run css-compile && pnpm run css-prefix && pnpm run css-minify",
|
||||
|
||||
Reference in New Issue
Block a user