diff --git a/src/__tests__/utils.test.ts b/src/__tests__/utils.test.ts
index b73590416..469aa3d6f 100644
--- a/src/__tests__/utils.test.ts
+++ b/src/__tests__/utils.test.ts
@@ -26,13 +26,13 @@ it('should wrap the id [2]', () => {
it('should wrap string with div', () => {
const tpl = 'qiankun';
- const factory = getDefaultTplWrapper('react16');
+ const factory = getDefaultTplWrapper('react16', { speedy: true });
const ret = factory(tpl);
expect(ret).toBe(
// eslint-disable-next-line max-len
- `
${tpl}
`,
+ `${tpl}
`,
);
});
diff --git a/src/loader.ts b/src/loader.ts
index 8ad2ec803..257653289 100644
--- a/src/loader.ts
+++ b/src/loader.ts
@@ -272,7 +272,7 @@ export async function loadApp(
await (prevAppUnmountedDeferred && prevAppUnmountedDeferred.promise);
}
- const appContent = getDefaultTplWrapper(appInstanceId)(template);
+ const appContent = getDefaultTplWrapper(appInstanceId, sandbox)(template);
const strictStyleIsolation = typeof sandbox === 'object' && !!sandbox.strictStyleIsolation;
@@ -311,7 +311,8 @@ export async function loadApp(
let mountSandbox = () => Promise.resolve();
let unmountSandbox = () => Promise.resolve();
const useLooseSandbox = typeof sandbox === 'object' && !!sandbox.loose;
- const speedySandbox = typeof sandbox === 'object' && !!sandbox.speedy;
+ // enable speedy mode by default
+ const speedySandbox = typeof sandbox === 'object' ? sandbox.speedy !== false : true;
let sandboxContainer;
if (sandbox) {
sandboxContainer = createSandboxContainer(
diff --git a/src/utils.ts b/src/utils.ts
index 5362f5f49..6464aaa21 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -130,7 +130,7 @@ export function isBoundedFunction(fn: CallableFunction) {
export const qiankunHeadTagName = 'qiankun-head';
-export function getDefaultTplWrapper(name: string) {
+export function getDefaultTplWrapper(name: string, sandboxOpts: FrameworkConfiguration['sandbox']) {
return (tpl: string) => {
let tplWithSimulatedHead: string;
@@ -146,7 +146,9 @@ export function getDefaultTplWrapper(name: string) {
return `${tplWithSimulatedHead}
`;
+ )}" data-name="${name}" data-version="${version}" data-sandbox-configuration="${JSON.stringify(
+ sandboxOpts,
+ )}">${tplWithSimulatedHead}`;
};
}