Skip to content

Instantly share code, notes, and snippets.

@fellypsantos
Created February 25, 2020 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fellypsantos/c58350d7fd5c8f2a8ed72fd00f84b1f7 to your computer and use it in GitHub Desktop.
Save fellypsantos/c58350d7fd5c8f2a8ed72fd00f84b1f7 to your computer and use it in GitHub Desktop.
Webpack configuration file, excluding devDependencies from build.
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const package = require('./package.json');
module.exports = {
mode: 'production',
target: 'node',
entry: path.resolve(__dirname, 'index.js'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'api.bundle.js'
},
externals: [
nodeExternals({
whitelist: Object.keys(package.dependencies)
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment