Skip to content

Commit

Permalink
Revert "chore: enable local worker file in development mode" (#4314)
Browse files Browse the repository at this point in the history
This reverts commit 5e82bb2.
  • Loading branch information
Ricbet authored Jan 13, 2025
1 parent b367234 commit f6bd660
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ export class ExpressFileServerContribution implements ServerAppContribution {
return;
}

if (process.env.NODE_ENV === 'development' && uriPath.startsWith('/monaco/worker')) {
const filePath = path.resolve(__dirname, `../../../${uriPath}`);
const contentType = ALLOW_MIME[path.extname(filePath).slice(1)];
if (!contentType) {
ctx.status = 404;
return;
}
ctx.set('Content-Type', contentType);
ctx.body = fs.createReadStream(filePath);
return;
}

const filePath = URI.parse(`file://${uriPath}`).codeUri.fsPath;
const whitelist = this.getWhiteList();
const contentType = ALLOW_MIME[path.extname(filePath).slice(1)];
Expand Down
12 changes: 1 addition & 11 deletions packages/monaco/src/browser/monaco.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,17 +301,7 @@ export class MonacoClientContribution
};

const getWorker = (moduleId, label) => {
let url: string;

/**
* 开发模式下,直接使用本地文件
*/
if (process.env.NODE_ENV === 'development') {
url = 'assets/monaco/worker/editor.worker.bundle.js';
} else {
url = getWorkerUrl(moduleId, label);
}

const url = getWorkerUrl(moduleId, label);
/**
* monaco 0.53 版本开始,创建 worker 线程时都指定了 type 为 module,而我们模块格式不兼容
* 所以需要覆写 getWorker 函数,手动创建 worker 线程
Expand Down

0 comments on commit f6bd660

Please sign in to comment.