mirror of
https://github.com/Moe-Sakura/frontend.git
synced 2026-04-04 08:25:07 +08:00
Merge pull request #83 from Moe-Sakura/dev
refactor: update PrismJS plugin in Vite configuration to use ESM import
This commit is contained in:
@@ -20,11 +20,11 @@ export default defineConfig({
|
||||
|
||||
plugins: [
|
||||
{
|
||||
name: 'prismjs-global-fix',
|
||||
name: 'prismjs-esm-fix',
|
||||
transform(code, id) {
|
||||
if (id.includes('prismjs/components/') && !id.includes('prism-core')) {
|
||||
return {
|
||||
code: `var Prism = (typeof window !== 'undefined' ? window : globalThis).Prism;\n${code}`,
|
||||
code: `import Prism from 'prismjs/components/prism-core';\n${code}`,
|
||||
map: null,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user