Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/fix-code-highlighter-languages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modelscope-studio/frontend': patch
'modelscope_studio': patch
---

fix: `antdx.CodeHighlighter` fails to load Prism languages (`Failed to resolve module specifier`) and renders code without highlighting in the production build
6 changes: 6 additions & 0 deletions .changeset/share-ant-design-x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modelscope-studio/frontend': patch
'modelscope_studio': patch
---

fix: share `@ant-design/x` across components instead of bundling a copy into each of them
6 changes: 6 additions & 0 deletions .changeset/share-svelte-runtime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modelscope-studio/frontend': patch
'modelscope_studio': patch
---

fix: components stop updating after the first render in the production build, e.g. revisited tabs or menu items no longer switch the content and `ms.AutoLoading` no longer shows up
2 changes: 1 addition & 1 deletion frontend/defineConfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import react from '@vitejs/plugin-react';

import { ModelScopeStudioVitePlugin } from './plugin.js';
import { ModelScopeStudioVitePlugin } from './plugins/index.js';

/**
* @type {(options:{ external?: boolean | { excludes:string[] } }) => any}
Expand Down
2 changes: 2 additions & 0 deletions frontend/fixtures.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ declare module 'virtual:component-loader' {
export const load_component;
}

declare module 'virtual:ms-svelte-runtime' {}

declare module '*?worker' {
const workerConstructor: {
new (options?: { name?: string }): Worker;
Expand Down
243 changes: 0 additions & 243 deletions frontend/plugin.js

This file was deleted.

39 changes: 39 additions & 0 deletions frontend/plugins/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import path from 'node:path';
import url from 'node:url';

const frontendDir = path.resolve(
path.dirname(url.fileURLToPath(import.meta.url)),
'..'
);

/**
* The source aliases (keep in sync with `paths` of the root `tsconfig.json`)
* and the production mode of the build.
*
* @type {() => import('vite').Plugin}
*/
export function configPlugin() {
return {
name: 'modelscope-studio-config',
config(userConfig, { command }) {
if (command === 'build') {
userConfig.define = {
...userConfig.define,
'process.env.NODE_ENV': JSON.stringify('production'),
};
userConfig.build ??= {};
}

userConfig.resolve ??= {};
userConfig.resolve.alias = {
...(userConfig.resolve.alias || {}),
'@utils': path.resolve(frontendDir, 'utils'),
'@globals': path.resolve(frontendDir, 'globals'),
'@svelte-preprocess-react': path.resolve(
frontendDir,
'svelte-preprocess-react'
),
};
},
};
}
Loading
Loading