|  | 
|  | 1 | +// Copyright (c) Microsoft Corporation. All rights reserved. | 
|  | 2 | +// Licensed under the MIT License. | 
|  | 3 | +'use strict'; | 
|  | 4 | +Object.defineProperty(exports, "__esModule", { value: true }); | 
|  | 5 | +const path = require("path"); | 
|  | 6 | +const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin"); | 
|  | 7 | +const webpack_1 = require("webpack"); | 
|  | 8 | +const constants_1 = require("../constants"); | 
|  | 9 | +const common_1 = require("./common"); | 
|  | 10 | +// tslint:disable-next-line:no-var-requires no-require-imports | 
|  | 11 | +const configFileName = path.join(constants_1.ExtensionRootDir, 'tsconfig.extension.json'); | 
|  | 12 | +const config = { | 
|  | 13 | + mode: 'production', | 
|  | 14 | + target: 'node', | 
|  | 15 | + entry: { | 
|  | 16 | + 'debugger/debugAdapter/main': './src/client/debugger/debugAdapter/main.ts' | 
|  | 17 | + }, | 
|  | 18 | + devtool: 'source-map', | 
|  | 19 | + node: { | 
|  | 20 | + __dirname: false | 
|  | 21 | + }, | 
|  | 22 | + module: { | 
|  | 23 | + rules: [ | 
|  | 24 | + { | 
|  | 25 | + // JupyterServices imports node-fetch using `eval`. | 
|  | 26 | + test: /@jupyterlab[\\\/]services[\\\/].*js$/, | 
|  | 27 | + use: [ | 
|  | 28 | + { | 
|  | 29 | + loader: path.join(__dirname, 'loaders', 'fixEvalRequire.js') | 
|  | 30 | + } | 
|  | 31 | + ] | 
|  | 32 | + }, | 
|  | 33 | + { | 
|  | 34 | + // Do not use __dirname in getos when using require. | 
|  | 35 | + test: /getos[\\\/]index.js$/, | 
|  | 36 | + use: [ | 
|  | 37 | + { | 
|  | 38 | + loader: path.join(__dirname, 'loaders', 'fixGetosRequire.js') | 
|  | 39 | + } | 
|  | 40 | + ] | 
|  | 41 | + }, | 
|  | 42 | + { | 
|  | 43 | + test: /\.ts$/, | 
|  | 44 | + exclude: /node_modules/, | 
|  | 45 | + use: [ | 
|  | 46 | + { | 
|  | 47 | + loader: 'ts-loader' | 
|  | 48 | + } | 
|  | 49 | + ] | 
|  | 50 | + } | 
|  | 51 | + ] | 
|  | 52 | + }, | 
|  | 53 | + externals: [ | 
|  | 54 | + 'vscode', | 
|  | 55 | + 'commonjs' | 
|  | 56 | + ], | 
|  | 57 | + plugins: [ | 
|  | 58 | + ...common_1.getDefaultPlugins('extension'), | 
|  | 59 | + new webpack_1.ContextReplacementPlugin(/getos/, /logic\/.*.js/) | 
|  | 60 | + ], | 
|  | 61 | + resolve: { | 
|  | 62 | + extensions: ['.ts', '.js'], | 
|  | 63 | + plugins: [ | 
|  | 64 | + new tsconfig_paths_webpack_plugin_1.TsconfigPathsPlugin({ configFile: configFileName }) | 
|  | 65 | + ] | 
|  | 66 | + }, | 
|  | 67 | + output: { | 
|  | 68 | + filename: '[name].js', | 
|  | 69 | + path: path.resolve(constants_1.ExtensionRootDir, 'out', 'client'), | 
|  | 70 | + libraryTarget: 'commonjs2', | 
|  | 71 | + devtoolModuleFilenameTemplate: '../../[resource-path]' | 
|  | 72 | + } | 
|  | 73 | +}; | 
|  | 74 | +// tslint:disable-next-line:no-default-export | 
|  | 75 | +exports.default = config; | 
0 commit comments