-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathwebpack.config.js
More file actions
105 lines (102 loc) · 3.43 KB
/
webpack.config.js
File metadata and controls
105 lines (102 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//@ts-check
'use strict';
const path = require('path');
const webpack = require('webpack');
const copy = require('copy-webpack-plugin');
/** @typedef {import('webpack').Configuration} WebpackConfig **/
/** @type WebpackConfig */
const common = {
mode: 'development',
devtool: 'source-map',
module: {
rules: [
{
test: /\.tsx?$/,
use: {
loader: 'ts-loader',
options: {
configFile: 'tsconfig.webpack.json',
onlyCompileBundledFiles: process.env.CI === 'true',
transpileOnly: process.env.CI === 'true' // full type-check locally; lighter in CI
}
},
exclude: /node_modules/
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
externals: {
vscode: 'commonjs vscode',
'applicationinsights-native-metrics': 'commonjs applicationinsights-native-metrics',
"@lydell/node-pty": "commonjs @lydell/node-pty",
}
};
/**
* @param {*} _env
* @param {*} argv
* @returns WebpackConfig[]
*/
module.exports = (_env, argv) => [
{
...common,
target: 'node',
entry: {
extension: './src/desktop/extension.ts'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'commonjs'
},
plugins: [
new webpack.ProvidePlugin({
crypto: ['crypto', 'webcrypto'],
fetch: ['node-fetch', 'default'],
Blob: ['fetch-blob', 'default'],
FormData: ['formdata-polyfill/esm.min.js', 'FormData']
}),
]
},
{
...common,
target: 'web',
// The VS Code devtools can't load up source maps for webview code, so we must include them inline.
// This increases the bundle size a lot, so only do this in development mode.
devtool: argv.mode === 'production' ? false : 'inline-source-map',
entry: {
manageComponentsPacks: './src/views/manage-components-packs/components-packs-webview-view.ts',
createSolution: './src/views/create-solutions/create-solution-webview-view.ts',
manageSolution: './src/views/manage-solution/manage-solution-webview-view.ts',
configWizard: './src/views/config-wizard/confwiz-webview-view.ts',
configureSolution: './src/views/manage-layers/manage-layers-webview-view.ts'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist', 'views')
},
plugins: [
new copy({
patterns: [
{
from: 'node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css',
to: 'css'
},
{
from: 'node_modules/@fortawesome/fontawesome-free/css/solid.min.css',
to: 'css'
},
{
from: 'node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2',
to: 'webfonts'
}
]
})
]
},
];