mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: 将monaco基础包全部移除,采用cdn形式注入
This commit is contained in:
parent
d5c8df8729
commit
510f1c0bc1
@ -17,6 +17,8 @@
|
||||
"@alifd/next": "var window.Next",
|
||||
"@ali/visualengine": "var window.VisualEngine",
|
||||
"@ali/visualengine-utils": "var window.VisualEngineUtils",
|
||||
"monaco-editor/esm/vs/editor/editor.api":"var window.monaco",
|
||||
"monaco-editor/esm/vs/editor/editor.main.js":"var window.monaco",
|
||||
"rax": "var window.Rax"
|
||||
},
|
||||
"plugins": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
||||
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
|
||||
|
||||
module.exports = ({ onGetWebpackConfig }) => {
|
||||
onGetWebpackConfig((config) => {
|
||||
@ -9,17 +8,6 @@ module.exports = ({ onGetWebpackConfig }) => {
|
||||
},
|
||||
]);
|
||||
|
||||
config
|
||||
// 定义插件名称
|
||||
.plugin('MonacoWebpackPlugin')
|
||||
// 第一项为具体插件,第二项为插件参数
|
||||
.use(
|
||||
new MonacoWebpackPlugin({
|
||||
languages: ['typescript', 'css', 'json'],
|
||||
}),
|
||||
[],
|
||||
);
|
||||
|
||||
config.plugins.delete('hot');
|
||||
config.devServer.hot(false);
|
||||
});
|
||||
|
||||
@ -39,7 +39,6 @@
|
||||
"@alife/theme-lowcode-light": "^0.1.0",
|
||||
"compare-versions": "^3.0.1",
|
||||
"react": "^16.8.1",
|
||||
"monaco-editor": "0.21.0",
|
||||
"react-dom": "^16.8.1",
|
||||
"streamsaver": "^2.0.4",
|
||||
"web-streams-polyfill": "^2.1.1"
|
||||
@ -53,7 +52,6 @@
|
||||
"build-plugin-fusion": "^0.1.0",
|
||||
"build-plugin-moment-locales": "^0.1.0",
|
||||
"build-plugin-react-app": "^1.1.2",
|
||||
"monaco-editor-webpack-plugin": "2.0.0",
|
||||
"tsconfig-paths-webpack-plugin": "^3.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>LowCodeEngine Editor DEMO</title>
|
||||
<link rel="shortcut icon" href="./favicon.png" />
|
||||
<link rel="stylesheet" data-name="vs/editor/editor.main" href="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.21.0/min/vs/editor/editor.main.css"/>
|
||||
<script src="https://g.alicdn.com/code/lib/react/16.9.0/umd/react.development.js"></script>
|
||||
<script src="https://g.alicdn.com/code/lib/react-dom/16.9.0/umd/react-dom.development.js"></script>
|
||||
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
|
||||
@ -17,6 +18,12 @@
|
||||
<link rel="stylesheet" href="https://unpkg.alibaba-inc.com/@alifd/next@1.20.25/dist/next.min.css" />
|
||||
<script src="https://unpkg.alibaba-inc.com/@alifd/next@1.20.25/dist/next.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/rax@1.1.3/dist/rax.js"></script>
|
||||
<script>
|
||||
var require = { paths: { vs: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.21.0/min/vs' } };
|
||||
</script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.21.0/min/vs/loader.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.21.0/min/vs/editor/editor.main.nls.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.21.0/min/vs/editor/editor.main.js"></script>
|
||||
<link rel="stylesheet" href="/css/editor-preset-vision.css" />
|
||||
<script>
|
||||
window.pageConfig = {
|
||||
|
||||
@ -463,30 +463,30 @@ class MonacoEditorDefaultView extends PureComponent {
|
||||
});
|
||||
}
|
||||
}
|
||||
const prefix = 'data:text/javascript;charset=utf-8,';
|
||||
const baseUrl = 'https://g.alicdn.com/iceluna/iceluna-vendor/0.0.1/';
|
||||
window.MonacoEnvironment = {
|
||||
getWorkerUrl(label: string) {
|
||||
if (label === 'json') {
|
||||
return `${prefix}${encodeURIComponent(`
|
||||
importScripts('${baseUrl}json.worker.js');`)}`;
|
||||
}
|
||||
if (['css', 'less', 'scss'].includes(label)) {
|
||||
return `${prefix}${encodeURIComponent(`
|
||||
importScripts('${baseUrl}css.worker.js');`)}`;
|
||||
}
|
||||
if (label === 'html') {
|
||||
return `${prefix}${encodeURIComponent(`
|
||||
importScripts('${baseUrl}html.worker.js');`)}`;
|
||||
}
|
||||
if (['typescript', 'javascript'].includes(label)) {
|
||||
return `${prefix}${encodeURIComponent(`
|
||||
importScripts('${baseUrl}typescript.worker.js');`)}`;
|
||||
}
|
||||
return `${prefix}${encodeURIComponent(`
|
||||
importScripts('${baseUrl}editor.worker.js');`)}`;
|
||||
},
|
||||
};
|
||||
// const prefix = 'data:text/javascript;charset=utf-8,';
|
||||
// const baseUrl = 'https://g.alicdn.com/iceluna/iceluna-vendor/0.0.1/';
|
||||
// window.MonacoEnvironment = {
|
||||
// getWorkerUrl(label: string) {
|
||||
// if (label === 'json') {
|
||||
// return `${prefix}${encodeURIComponent(`
|
||||
// importScripts('${baseUrl}json.worker.js');`)}`;
|
||||
// }
|
||||
// if (['css', 'less', 'scss'].includes(label)) {
|
||||
// return `${prefix}${encodeURIComponent(`
|
||||
// importScripts('${baseUrl}css.worker.js');`)}`;
|
||||
// }
|
||||
// if (label === 'html') {
|
||||
// return `${prefix}${encodeURIComponent(`
|
||||
// importScripts('${baseUrl}html.worker.js');`)}`;
|
||||
// }
|
||||
// if (['typescript', 'javascript'].includes(label)) {
|
||||
// return `${prefix}${encodeURIComponent(`
|
||||
// importScripts('${baseUrl}typescript.worker.js');`)}`;
|
||||
// }
|
||||
// return `${prefix}${encodeURIComponent(`
|
||||
// importScripts('${baseUrl}editor.worker.js');`)}`;
|
||||
// },
|
||||
// };
|
||||
|
||||
// eslint-disable-next-line react/no-multi-comp
|
||||
export default class MonacoEditorButtonView extends PureComponent {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user