mirror of
https://git.um-react.app/um/um-react.git
synced 2026-11-25 06:46:59 +00:00
feat: update asset directory structure
- Changed the asset directory in Vite configuration to 'um-react.assets' for better organization. - Updated the minification script to read from and write to the new asset directory, ensuring consistency in asset handling.
This commit is contained in:
1 parent
94eab8ecf6
commit
ef4cd9c21e
2 files changed
+6
-3
No files matched your search
@@ -1,7 +1,9 @@
|
||||
import { minify } from 'terser';
|
||||
import { readFileSync, writeFileSync, readdirSync } from 'fs';
|
||||
|
||||
for (const file of readdirSync('dist/assets')) {
|
||||
const assetsDir = 'dist/um-react.assets';
|
||||
|
||||
for (const file of readdirSync(assetsDir)) {
|
||||
if (!/\.(mjs|js)$/.test(file)) {
|
||||
continue;
|
||||
}
|
||||
@@ -9,11 +11,11 @@ for (const file of readdirSync('dist/assets')) {
|
||||
console.log(`minifying ${file}...`);
|
||||
const isModule = /\.mjs$/.test(file);
|
||||
|
||||
const output = await minify(readFileSync(`dist/assets/${file}`, 'utf-8'), {
|
||||
const output = await minify(readFileSync(`${assetsDir}/${file}`, 'utf-8'), {
|
||||
compress: true,
|
||||
mangle: true,
|
||||
module: isModule,
|
||||
});
|
||||
|
||||
writeFileSync(`dist/assets/${file}`, output.code);
|
||||
writeFileSync(`${assetsDir}/${file}`, output.code);
|
||||
}
|
||||
@@ -97,6 +97,7 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
build: {
|
||||
assetsDir: 'um-react.assets',
|
||||
minify: true,
|
||||
rolldownOptions: {
|
||||
output: {
|
||||
|
||||
Reference in new issue
Block a user