mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
build: 使用esbuildOptions定义global
This commit is contained in:
parent
08faee9cab
commit
458f493150
@ -15,8 +15,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import './utils/polyfills';
|
|
||||||
|
|
||||||
import { App } from 'vue';
|
import { App } from 'vue';
|
||||||
|
|
||||||
import Code from './fields/Code.vue';
|
import Code from './fields/Code.vue';
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
// serialize-javascript 依赖的 randombytes 依赖全局的 global 对象,因此此处需添加 global polyfill
|
|
||||||
if (typeof global === 'undefined') {
|
|
||||||
(window as any).global = window;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof globalThis === 'undefined') {
|
|
||||||
(window as any).globalThis = window;
|
|
||||||
}
|
|
@ -39,6 +39,14 @@ export default defineConfig({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
optimizeDeps: {
|
||||||
|
esbuildOptions: {
|
||||||
|
define: {
|
||||||
|
global: 'globalThis',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
build: {
|
build: {
|
||||||
cssCodeSplit: false,
|
cssCodeSplit: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import './polyfills';
|
|
||||||
|
|
||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import ElementPlus from 'element-plus';
|
import ElementPlus from 'element-plus';
|
||||||
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* Tencent is pleased to support the open source community by making TMagicEditor available.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (typeof (window as any).global === 'undefined') {
|
|
||||||
(window as any).global = window;
|
|
||||||
}
|
|
@ -33,7 +33,7 @@ export default defineConfig({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
||||||
base: '/tmagic-editor/playground',
|
base: '/tmagic-editor/playground/',
|
||||||
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: [
|
alias: [
|
||||||
@ -53,6 +53,14 @@ export default defineConfig({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
optimizeDeps: {
|
||||||
|
esbuildOptions: {
|
||||||
|
define: {
|
||||||
|
global: 'globalThis',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
server: {
|
server: {
|
||||||
fs: {
|
fs: {
|
||||||
strict: false,
|
strict: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user