Skip to content

refine#483

Merged
star-e merged 4 commits intococos:main-previewfrom
bofeng-song:main-preview
Apr 15, 2026
Merged

refine#483
star-e merged 4 commits intococos:main-previewfrom
bofeng-song:main-preview

Conversation

@bofeng-song
Copy link
Copy Markdown
Contributor

No description provided.

@bofeng-song bofeng-song requested a review from knoxHuang April 14, 2026 12:42
Comment thread static/web/boot.js Outdated
const map3 = document.createElement('script');
map3.type = 'systemjs-importmap';
map3.src = '/scripting/import-map-global';
document.head.appendChild(map3);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const loadImportMaps = () => {
const sources = [
${env.engineDistPath}/import-map.json,
env.packImportMapURL,
'/scripting/import-map-global'
];

sources.forEach(src => {
    const script = document.createElement('script');
    Object.assign(script, {
        type: 'systemjs-importmap',
        src
    });
    document.head.appendChild(script);
});

};

方便后续如何有 map 加入,直接在 sources 加一个字符串就行

Comment thread static/web/editor-stub-preload.js Outdated
if (typeof window.require === 'undefined') {
const fsMock = {
readFile: function (filePath) {
const requestUrl = `${window.location.origin}/engine/read-file-sync?path=${encodeURIComponent(filePath)}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window.location.origin; 需要改成通过获取服务器 URL 的 API

throw new Error('Failed to read file: ' + filePath);
});
},
readFileSync: function (filePath) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是否需要再优化一下代码

@star-e star-e merged commit f9ad124 into cocos:main-preview Apr 15, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants