microsoft / vscode-loader

An universal Asynchronous Module Definition (AMD) Loader developed primarily to load VSCode's sources.
Other
170 stars 55 forks source link

Why doesn't VSCode use require.js directly? #11

Open vikyd opened 6 years ago

vikyd commented 6 years ago

Why doesn't VSCode use require.js directly?

jinwenhua commented 4 years ago

I wonder if you can slove the problem when I use require.js directly? ReferenceError: define is not defined at NLSLoaderPlugin (d:\gitbook\IDEbook\search\output\vs\nls.js:152:5) at Object. (d:\gitbook\IDEbook\search\output\vs\nls.js:153:3) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (d:\gitbook\IDEbook\search\output\vs\platform\workspaces\common\workspaces.js:9:15) Waiting for the debugger to disconnect...

aztack commented 3 years ago

I wonder if you can slove the problem when I use require.js directly? ReferenceError: define is not defined at NLSLoaderPlugin (d:\gitbook\IDEbook\search\output\vs\nls.js:152:5) at Object. (d:\gitbook\IDEbook\search\output\vs\nls.js:153:3) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (d:\gitbook\IDEbook\search\output\vs\platform\workspaces\common\workspaces.js:9:15) Waiting for the debugger to disconnect...

<script type="text/javascript" src="loader.js"></script>
<script>
    globalThis.define = loader;
</script>
aztack commented 3 years ago

Why doesn't VSCode use require.js directly?

The vscode-loader supports multiple environment(node, web, electron and web worker) and can switch different implementation automatically. Maybe this is the reason.