Copy webServer from Typescript to VS Code (#165771)

* Initial draft.

Not working.
Also not correctly formatted, I'll do that later.

* Various fixes

It works now

* A bit of cleanup

* Move webServer to its own directory

And prepare for getting rid of dynamicImportCompat.js hack

* Remove dynamicImportCompat.js hack

* Revert unrelated change

* Webpac tsserver.web.js with webServer.ts as entrypoint

Instead of using CopyPlugin.

1. Shipping multiple entrypoints in a single file required fixes to
build code.
2. There are a couple of warnings from `require` calls in
tsserverlibrary.js. Those are not relevant since they're in non-web
code, but I haven't figured how to turn them off; they are fully dynamic
so `externals` didn't work.

* Ignore warnings from dynamic import in tsserver

* Add to .vscodeignore files
This commit is contained in:
Nathan Shively-Sanders
2022-11-14 10:56:31 -08:00
committed by GitHub
parent 7f9aa0535a
commit cb43019d6a
9 changed files with 578 additions and 54 deletions

View File

@@ -414,19 +414,14 @@ async function webpackExtensions(taskName, isWatch, webpackConfigLocations) {
const webpackConfigs = [];
for (const { configPath, outputRoot } of webpackConfigLocations) {
const configOrFnOrArray = require(configPath);
function addConfig(configOrFn) {
let config;
if (typeof configOrFn === 'function') {
config = configOrFn({}, {});
function addConfig(configOrFnOrArray) {
for (const configOrFn of Array.isArray(configOrFnOrArray) ? configOrFnOrArray : [configOrFnOrArray]) {
const config = typeof configOrFn === 'function' ? configOrFn({}, {}) : configOrFn;
if (outputRoot) {
config.output.path = path.join(outputRoot, path.relative(path.dirname(configPath), config.output.path));
}
webpackConfigs.push(config);
}
else {
config = configOrFn;
}
if (outputRoot) {
config.output.path = path.join(outputRoot, path.relative(path.dirname(configPath), config.output.path));
}
webpackConfigs.push(configOrFn);
}
addConfig(configOrFnOrArray);
}