refactor: optimize component lifecycle and build process

- React: Removed unnecessary dependencies from useEffect in Artplayer component.
- Vue: Simplified instance emission in Artplayer component by removing nextTick.
- Build script: Added cpy to copy built i18n files to a new directory and set context to browser for Parcel.
This commit is contained in:
Harvey Zack committed 2025-08-17 17:25:16 +08:00
1 parent 0eed9c114b
commit 5cc6724f54
17 files changed
+25 -19

No files matched your search

+4
View File
@@ -2,11 +2,13 @@ import fs from 'node:fs'
import path from 'node:path'
import process from 'node:process'
import { Parcel } from '@parcel/core'
import cpy from 'cpy'
import { glob } from 'glob'
const basePath = 'packages/artplayer'
const i18nSrcDir = path.join(basePath, 'src/i18n')
const distDir = path.join(basePath, 'dist/i18n')
const compiledPath = path.resolve('docs/compiled/i18n')
const entries = glob.sync('*.js', {
cwd: i18nSrcDir,
@@ -44,6 +46,7 @@ async function buildI18n() {
defaultConfig: '@parcel/config-default',
mode: 'production',
defaultTargetOptions: {
context: 'browser',
distDir: distMjs,
outputFormat: 'esmodule',
sourceMaps: false,
@@ -73,6 +76,7 @@ async function buildI18n() {
fs.rmSync(distJs, { recursive: true, force: true })
fs.rmSync(distMjs, { recursive: true, force: true })
await cpy(distDir, compiledPath)
console.log('✨ Finished building i18n with both .js and .mjs')
}