2020-07-21 20:57:10 +00:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
* 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';
|
2020-07-21 23:13:52 +00:00
|
|
|
const CopyPlugin = require('copy-webpack-plugin');
|
2022-08-02 18:00:22 +00:00
|
|
|
const path = require('path');
|
2020-07-21 20:57:10 +00:00
|
|
|
|
2021-07-09 09:55:21 +00:00
|
|
|
const defaultConfig = require('../shared.webpack.config');
|
|
|
|
const withBrowserDefaults = defaultConfig.browser;
|
|
|
|
const browserPlugins = defaultConfig.browserPlugins;
|
2020-07-21 20:57:10 +00:00
|
|
|
|
2021-01-05 20:57:26 +00:00
|
|
|
const languages = [
|
|
|
|
'zh-tw',
|
|
|
|
'cs',
|
|
|
|
'de',
|
|
|
|
'es',
|
|
|
|
'fr',
|
|
|
|
'it',
|
|
|
|
'ja',
|
|
|
|
'ko',
|
|
|
|
'pl',
|
|
|
|
'pt-br',
|
|
|
|
'ru',
|
|
|
|
'tr',
|
|
|
|
'zh-cn',
|
|
|
|
];
|
2022-11-15 22:55:40 +00:00
|
|
|
module.exports = [withBrowserDefaults({
|
2020-07-21 20:57:10 +00:00
|
|
|
context: __dirname,
|
|
|
|
entry: {
|
|
|
|
extension: './src/extension.browser.ts',
|
2020-07-21 23:13:52 +00:00
|
|
|
},
|
|
|
|
plugins: [
|
2022-08-08 16:11:16 +00:00
|
|
|
...browserPlugins(__dirname), // add plugins, don't replace inherited
|
2021-07-08 19:41:03 +00:00
|
|
|
|
2020-07-21 23:13:52 +00:00
|
|
|
// @ts-ignore
|
|
|
|
new CopyPlugin({
|
|
|
|
patterns: [
|
2020-07-22 21:44:13 +00:00
|
|
|
{
|
2021-02-01 22:15:27 +00:00
|
|
|
from: '../node_modules/typescript/lib/*.d.ts',
|
|
|
|
to: 'typescript/',
|
2023-03-17 17:55:15 +00:00
|
|
|
flatten: true
|
2020-07-24 20:49:59 +00:00
|
|
|
},
|
2021-01-05 20:57:26 +00:00
|
|
|
{
|
2021-02-01 22:15:27 +00:00
|
|
|
from: '../node_modules/typescript/lib/typesMap.json',
|
|
|
|
to: 'typescript/'
|
2021-01-05 20:57:26 +00:00
|
|
|
},
|
|
|
|
...languages.map(lang => ({
|
2021-02-01 22:15:27 +00:00
|
|
|
from: `../node_modules/typescript/lib/${lang}/**/*`,
|
2023-03-17 17:55:15 +00:00
|
|
|
to: 'typescript/',
|
|
|
|
transformPath: (targetPath) => {
|
|
|
|
return targetPath.replace(/\.\.[\/\\]node_modules[\/\\]typescript[\/\\]lib/, '');
|
2021-01-05 20:57:26 +00:00
|
|
|
}
|
|
|
|
}))
|
2020-07-24 20:49:59 +00:00
|
|
|
],
|
|
|
|
}),
|
2020-07-21 23:13:52 +00:00
|
|
|
],
|
2022-11-15 22:55:40 +00:00
|
|
|
}), withBrowserDefaults({
|
|
|
|
context: __dirname,
|
|
|
|
entry: {
|
|
|
|
'typescript/tsserver.web': './web/webServer.ts'
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
exprContextCritical: false,
|
|
|
|
},
|
2023-02-01 23:12:13 +00:00
|
|
|
ignoreWarnings: [/Critical dependency: the request of a dependency is an expression/],
|
2022-11-15 22:55:40 +00:00
|
|
|
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',
|
|
|
|
}
|
|
|
|
})];
|