修改编辑器cdn

This commit is contained in:
whyour 2022-02-20 21:36:01 +08:00
parent 7e34f4990d
commit 7ea9a8aa57
5 changed files with 84 additions and 13 deletions

View File

@ -9,6 +9,7 @@ export default defineConfig({
type: 'none',
},
fastRefresh: {},
esbuild: {},
dynamicImport: {
loading: '@/components/pageLoading',
},

View File

@ -79,6 +79,7 @@
"@types/sockjs-client": "^1.5.1",
"@types/uuid": "^8.3.3",
"@umijs/plugin-antd": "^0.11.0",
"@umijs/plugin-esbuild": "^1.4.1",
"@umijs/test": "^3.3.9",
"antd": "^4.17.0-alpha.6",
"codemirror": "^5.62.2",

View File

@ -24,14 +24,7 @@ import { message, Badge, Modal, Avatar, Dropdown, Menu, Image } from 'antd';
// @ts-ignore
import SockJS from 'sockjs-client';
import * as Sentry from '@sentry/react';
import { Integrations } from '@sentry/tracing';
Sentry.init({
dsn: 'https://3406424fb1dc4813a62d39e844a9d0ac@o1098464.ingest.sentry.io/6122818',
integrations: [new Integrations.BrowserTracing()],
release: version,
tracesSampleRate: 1.0,
});
import { init } from '../utils/init';
export default function (props: any) {
const ctx = useCtx();
@ -107,10 +100,6 @@ export default function (props: any) {
}
};
useEffect(() => {
vhCheck();
}, []);
useEffect(() => {
if (systemInfo && systemInfo.isInitialized && !user) {
getUser();
@ -128,6 +117,9 @@ export default function (props: any) {
}, [theme.theme]);
useEffect(() => {
vhCheck();
init();
const _theme = localStorage.getItem('qinglong_dark_theme') || 'auto';
setFetchMethod(window.fetch);
if (_theme === 'dark') {

26
src/utils/init.ts Normal file
View File

@ -0,0 +1,26 @@
import * as Sentry from '@sentry/react';
import { Integrations } from '@sentry/tracing';
import { loader } from '@monaco-editor/react';
import { version } from '../version';
export function init() {
// sentry监控 init
Sentry.init({
dsn: 'https://3406424fb1dc4813a62d39e844a9d0ac@o1098464.ingest.sentry.io/6122818',
integrations: [new Integrations.BrowserTracing()],
release: version,
tracesSampleRate: 1.0,
});
// monaco 编辑器配置cdn和locale
loader.config({
paths: {
vs: 'https://cdn.staticfile.org/monaco-editor/0.32.1/min/vs',
},
'vs/nls': {
availableLanguages: {
'*': 'zh-cn',
},
},
});
}

View File

@ -1596,6 +1596,13 @@
antd "^4.1.3"
antd-mobile "^2.3.1"
"@umijs/plugin-esbuild@^1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@umijs/plugin-esbuild/-/plugin-esbuild-1.4.1.tgz#9cca180cd666f5bdf85261fc7a46b69cf35e3a65"
integrity sha512-3B5vhffgbtB/D/Xv2JQ4WRvDo3wvhr9YD90XrRbO17bgl50yj6CVVU6ulM2kCRtn4d7qcM+aMSGz220AwnfCOQ==
dependencies:
esbuild-loader "~2.9.2"
"@umijs/preset-built-in@3.5.20":
version "3.5.20"
resolved "https://registry.npmjs.org/@umijs/preset-built-in/-/preset-built-in-3.5.20.tgz"
@ -4037,11 +4044,28 @@ es5-imcompatible-versions@^0.1.62:
resolved "https://registry.npmjs.org/es5-imcompatible-versions/-/es5-imcompatible-versions-0.1.73.tgz"
integrity sha512-P0SgLrYl9iqlrt0h6n/iz5z5P1uuhnfHp9BA/tcLfqgVIWHNvY4Rm+jtSvnh1ADK4DJOYDwJvxlrHMRoLQMgmQ==
esbuild-loader@~2.9.2:
version "2.9.2"
resolved "https://registry.yarnpkg.com/esbuild-loader/-/esbuild-loader-2.9.2.tgz#ae16721aeb05018396395a95f528c778ba7361d0"
integrity sha512-HpF+r/ES2aC40VDOIFsP8OIOM2y2vj8LyLwJ4G8DCMOi8Kov68TwCtxiMMTuSuxR/xKDu/ykgVyCEgps6BXpYw==
dependencies:
esbuild "^0.8.42"
joycon "^2.2.5"
json5 "^2.2.0"
loader-utils "^2.0.0"
type-fest "^0.20.2"
webpack-sources "^2.2.0"
esbuild@0.12.15:
version "0.12.15"
resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.12.15.tgz"
integrity sha512-72V4JNd2+48eOVCXx49xoSWHgC3/cCy96e7mbXKY+WOWghN00cCmlGnwVLRhRHorvv0dgCyuMYBZlM2xDM5OQw==
esbuild@^0.8.42:
version "0.8.57"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.8.57.tgz#a42d02bc2b57c70bcd0ef897fe244766bb6dd926"
integrity sha512-j02SFrUwFTRUqiY0Kjplwjm1psuzO1d6AjaXKuOR9hrY0HuPsT6sV42B6myW34h1q4CRy+Y3g4RU/cGJeI/nNA==
escalade@^3.1.1:
version "3.1.1"
resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz"
@ -6108,6 +6132,11 @@ joi@17.x.x:
"@sideway/formula" "^3.0.0"
"@sideway/pinpoint" "^2.0.0"
joycon@^2.2.5:
version "2.2.5"
resolved "https://registry.yarnpkg.com/joycon/-/joycon-2.2.5.tgz#8d4cf4cbb2544d7b7583c216fcdfec19f6be1615"
integrity sha512-YqvUxoOcVPnCp0VU1/56f+iKSdvIRJYPznH22BdXV3xMk75SFXhWeJkZ8C9XxUWt1b5x2X1SxuFygW1U0FmkEQ==
"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz"
@ -6250,7 +6279,7 @@ json5@^1.0.1:
dependencies:
minimist "^1.2.0"
json5@^2.1.2:
json5@^2.1.2, json5@^2.2.0:
version "2.2.0"
resolved "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz"
integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==
@ -6438,6 +6467,15 @@ loader-utils@^1.1.0:
emojis-list "^3.0.0"
json5 "^1.0.1"
loader-utils@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.2.tgz#d6e3b4fb81870721ae4e0868ab11dd638368c129"
integrity sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"
json5 "^2.1.2"
locate-path@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz"
@ -10783,6 +10821,11 @@ type-detect@4.0.8:
resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz"
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
type-fest@^0.20.2:
version "0.20.2"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
type-fest@^0.21.3:
version "0.21.3"
resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz"
@ -11242,6 +11285,14 @@ webpack-sources@^1.4.3:
source-list-map "^2.0.0"
source-map "~0.6.1"
webpack-sources@^2.2.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.3.1.tgz#570de0af163949fe272233c2cefe1b56f74511fd"
integrity sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA==
dependencies:
source-list-map "^2.0.1"
source-map "^0.6.1"
webpack-sources@^2.3.0:
version "2.3.0"
resolved "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.3.0.tgz"