MCPcopy Create free account
hub / github.com/Snapchat/Valdi / runWebpack

Function runWebpack

valdi/vscode_debugger/gulpfile.js:179–254  ·  view source on GitHub ↗
({
  packages = [],
  devtool = false,
  compileInPlace = false,
  mode = process.argv.includes('watch') ? 'development' : 'production',
} = options)

Source from the content-addressed store, hash-verified

177);
178
179async function runWebpack({
180 packages = [],
181 devtool = false,
182 compileInPlace = false,
183 mode = process.argv.includes('watch') ? 'development' : 'production',
184} = options) {
185 // add the entrypoints common to both vscode and vs here
186 packages = [
187 ...packages,
188 { entry: `${buildSrcDir}/common/hash/hash.js`, library: false },
189 { entry: `${buildSrcDir}/${nodeTargetsDir}/bootloader.js`, library: false },
190 { entry: `${buildSrcDir}/${nodeTargetsDir}/watchdog.js`, library: false },
191 ];
192
193 let configs = [];
194 for (const { entry, library, filename } of packages) {
195 const config = {
196 mode: 'development',
197 target: 'node',
198 entry: path.resolve(entry),
199 output: {
200 path: compileInPlace ? path.resolve(path.dirname(entry)) : path.resolve(distSrcDir),
201 filename: filename || path.basename(entry).replace('.js', '.bundle.js'),
202 devtoolModuleFilenameTemplate: '../[resource-path]',
203 },
204 devtool: devtool,
205 resolve: {
206 extensions: ['.js', '.json'],
207 },
208 module: {
209 rules: [
210 {
211 loader: 'vscode-nls-dev/lib/webpack-loader',
212 options: {
213 base: path.join(__dirname, 'out/src'),
214 },
215 },
216 ],
217 },
218 node: {
219 __dirname: false,
220 __filename: false,
221 },
222 externals: {
223 vscode: 'commonjs vscode',
224 },
225 };
226
227 if (library) {
228 config.output.libraryTarget = 'commonjs2';
229 }
230
231 if (process.argv.includes('--analyze-size')) {
232 config.plugins = [
233 new (require('webpack-bundle-analyzer').BundleAnalyzerPlugin)({
234 analyzerMode: 'static',
235 reportFilename: path.resolve(distSrcDir, path.basename(entry) + '.html'),
236 }),

Callers 1

gulpfile.jsFile · 0.85

Calls 6

rejectFunction · 0.85
resolveMethod · 0.65
replaceMethod · 0.65
resolveFunction · 0.50
joinMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected