insomnia/packages/insomnia-app/send-request/webpack.config.babel.js
Gregory Schier 45861b6393
POC to get Insomnia networking available outside of app (#2329)
* Hacked insomnia lib package to get Insomnia's networking in tests

* Some small tweaks

* Got it mostly working

* Tweak

* Fix

* Fix pkg

* Fix some things

* Add comment

* Comment out log

* Some tweaks after doing a self code review

* Fix test

* Update app name for `insomnia-send-request`

* Update package-lock

* Update package-locks

* Fix tests

* Add gitignore

* Fix tests hopefully

* Fix accidental dep deletions

* Fix tests again

* Mock for all tests

* Update tests again

* Don't compile for Electron for tests

* Update release scripts to disable tests
2020-06-30 12:36:15 -07:00

51 lines
1.3 KiB
JavaScript

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',
},
},
],
},
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: [
// Set the APP_ID environment variable because it's required to access the app config
new webpack.DefinePlugin({ 'process.env.APP_ID': JSON.stringify('com.insomnia.designer') }),
],
};