Files
vscode/extensions/typescript-language-features/extension-browser.webpack.config.js
Nathan Shively-Sanders cb43019d6a 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
2022-11-14 10:56:31 -08:00

78 lines
1.9 KiB
JavaScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
'use strict';
const CopyPlugin = require('copy-webpack-plugin');
const path = require('path');
const defaultConfig = require('../shared.webpack.config');
const withBrowserDefaults = defaultConfig.browser;
const browserPlugins = defaultConfig.browserPlugins;
const languages = [
'zh-tw',
'cs',
'de',
'es',
'fr',
'it',
'ja',
'ko',
'pl',
'pt-br',
'ru',
'tr',
'zh-cn',
];
module.exports = [withBrowserDefaults({
context: __dirname,
entry: {
extension: './src/extension.browser.ts',
},
plugins: [
...browserPlugins(__dirname), // add plugins, don't replace inherited
// @ts-ignore
new CopyPlugin({
patterns: [
{
from: '../node_modules/typescript/lib/*.d.ts',
to: 'typescript/',
flatten: true
},
{
from: '../node_modules/typescript/lib/typesMap.json',
to: 'typescript/'
},
...languages.map(lang => ({
from: `../node_modules/typescript/lib/${lang}/**/*`,
to: 'typescript/',
transformPath: (targetPath) => {
return targetPath.replace(/\.\.[\/\\]node_modules[\/\\]typescript[\/\\]lib/, '');
}
}))
],
}),
],
}), withBrowserDefaults({
context: __dirname,
entry: {
'typescript/tsserver.web': './web/webServer.ts'
},
ignoreWarnings: [/Critical dependency: the request of a dependency is an expression/],
output: {
// all output goes into `dist`.
// packaging depends on that and this must always be like it
filename: '[name].js',
path: path.join(__dirname, 'dist', 'browser'),
libraryTarget: undefined,
},
externals: {
'perf_hooks': 'commonjs perf_hooks',
}
})];