2020-06-30 19:36:15 +00:00
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const pkg = require('../package.json');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
context: __dirname,
|
|
|
|
entry: {
|
|
|
|
index: './index.js',
|
|
|
|
},
|
|
|
|
target: 'node',
|
|
|
|
mode: 'production',
|
|
|
|
devtool: 'source-map',
|
|
|
|
optimization: {
|
|
|
|
minimize: false,
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
filename: 'index.js',
|
|
|
|
library: 'insomniasendrequest',
|
|
|
|
libraryTarget: 'commonjs2',
|
|
|
|
|
|
|
|
// Export directly where we need it for now
|
|
|
|
path: path.resolve(__dirname, '../../insomnia-send-request/dist'),
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
},
|
|
|
|
},
|
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
|
|
|
|
electron: path.resolve(path.join(__dirname, './electron')),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [
|
2020-12-07 20:36:13 +00:00
|
|
|
new webpack.ProvidePlugin({ window: path.resolve(path.join(__dirname, './window-shim')) }),
|
2020-06-30 19:36:15 +00:00
|
|
|
],
|
|
|
|
};
|