-
Notifications
You must be signed in to change notification settings - Fork 133
/
webpack.config.js
120 lines (118 loc) · 3.07 KB
/
webpack.config.js
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
const webpack = require('webpack');
const path = require('path');
module.exports = function (env, argv) {
env = env || {};
return [{
name: 'assets',
mode: 'none',
entry: {
overview: './src/overview/assets/index.ts',
'beginner-tips': './src/beginner-tips/assets/index.tsx',
'ext-guide': './src/ext-guide/assets/index.ts',
welcome: './src/welcome/assets/index.ts',
'project-settings': './src/project-settings/assets/index.tsx',
'formatter-settings': './src/formatter-settings/assets/index.tsx',
'install-jdk': './src/install-jdk/assets/index.tsx'
},
module: {
rules: [{
test: /\.ts(x?)$/,
exclude: /node_modules/,
use: 'ts-loader'
}, {
test: /\.(scss)$/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader'
}, {
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
[
"autoprefixer",
{
// Options
},
],
],
},
}
}, {
loader: 'sass-loader'
}]
}, {
test: /\.(jpg|png|svg|ico|icns)$/,
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: 200000,
},
},
}, {
test: /\.(css)$/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader'
}]
}, {
test: /\.(woff2|ttf)$/,
type: 'asset/inline',
}]
},
output: {
filename: 'assets/[name]/index.js',
path: path.resolve(__dirname, 'out'),
publicPath: '/',
devtoolModuleFilenameTemplate: "../[resource-path]"
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
}),
],
devtool: 'source-map',
resolve: {
extensions: ['.js', '.ts', '.tsx'],
// https://github.com/react-dnd/react-dnd/issues/3425#issuecomment-1214554950
fallback: {
'process/browser': require.resolve('process/browser'),
}
}
}, {
name: 'extension',
target: 'node',
mode: 'none',
entry: {
extension: './src/extension.ts'
},
module: {
rules: [{
test: /\.ts$/,
exclude: /node_modules/,
use: 'ts-loader'
}]
},
resolve: {
modules: ['node_modules', path.resolve(__dirname, 'src')],
mainFiles: ['index'],
extensions: ['.js', '.ts', '.json'],
preferRelative: true
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'out'),
libraryTarget: "commonjs2",
publicPath: '/',
devtoolModuleFilenameTemplate: "../[resource-path]"
},
externals: {
'applicationinsights-native-metrics': 'commonjs applicationinsights-native-metrics', // ignored because we don't ship native module
'diagnostic-channel-publishers': 'commonjs diagnostic-channel-publishers',
vscode: 'commonjs vscode'
},
devtool: 'source-map'
}]
};