2021-05-12 06:35:00 +00:00
|
|
|
import path from 'path';
|
2021-07-22 23:04:56 +00:00
|
|
|
import { Configuration, ProvidePlugin } from 'webpack';
|
|
|
|
|
2021-05-12 06:35:00 +00:00
|
|
|
import pkg from '../package.json';
|
2020-06-30 19:36:15 +00:00
|
|
|
|
2021-05-12 06:35:00 +00:00
|
|
|
const configuration: Configuration = {
|
|
|
|
context: path.join(__dirname, '../send-request'),
|
2020-06-30 19:36:15 +00:00
|
|
|
entry: {
|
2021-05-12 06:35:00 +00:00
|
|
|
index: './index.ts',
|
2020-06-30 19:36:15 +00:00
|
|
|
},
|
|
|
|
target: 'node',
|
|
|
|
mode: 'production',
|
|
|
|
devtool: 'source-map',
|
|
|
|
optimization: {
|
|
|
|
minimize: false,
|
|
|
|
},
|
|
|
|
output: {
|
2021-05-12 06:35:00 +00:00
|
|
|
filename: '[name].js',
|
2020-06-30 19:36:15 +00:00
|
|
|
library: 'insomniasendrequest',
|
|
|
|
libraryTarget: 'commonjs2',
|
|
|
|
|
|
|
|
// Export directly where we need it for now
|
|
|
|
path: path.resolve(__dirname, '../../insomnia-send-request/dist'),
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2021-05-12 06:35:00 +00:00
|
|
|
test: /\.tsx?$/,
|
|
|
|
loader: 'ts-loader',
|
|
|
|
exclude: [/node_modules/],
|
|
|
|
options: {
|
|
|
|
configFile: 'tsconfig.build.sr.json',
|
2020-06-30 19:36:15 +00:00
|
|
|
},
|
|
|
|
},
|
2021-01-28 10:46:19 +00:00
|
|
|
{
|
|
|
|
test: require.resolve('../app/network/ca-certs.js'),
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'val-loader',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-06-30 19:36:15 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
externals: [
|
|
|
|
// Omit all dependencies in app/package.json (we want them loaded at runtime via NodeJS)
|
|
|
|
...Object.keys(pkg.dependencies).filter(name => !pkg.packedDependencies.includes(name)),
|
|
|
|
],
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
// Replace electron with a minimal polyfill that contains just enough to get
|
|
|
|
// the things in this bundle working
|
2021-05-12 06:35:00 +00:00
|
|
|
electron: path.resolve(path.join(__dirname, '../send-request/electron')),
|
2020-06-30 19:36:15 +00:00
|
|
|
},
|
2021-05-12 06:35:00 +00:00
|
|
|
extensions: ['.js', '.json', '.ts', '.tsx'],
|
2020-06-30 19:36:15 +00:00
|
|
|
},
|
|
|
|
plugins: [
|
2021-05-12 06:35:00 +00:00
|
|
|
new ProvidePlugin({ window: path.resolve(path.join(__dirname, '../send-request/window-shim')) }),
|
2020-06-30 19:36:15 +00:00
|
|
|
],
|
|
|
|
};
|
2021-05-12 06:35:00 +00:00
|
|
|
|
|
|
|
export default configuration;
|