Last active
May 24, 2019 15:47
-
-
Save apotox/3c1261e682dfeb7d0cbb0c17a02f0d80 to your computer and use it in GitHub Desktop.
webpack.config.js firebase-sdk-with-netlify-functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//webpack.config.js | |
require('dotenv').config() | |
const path = require('path'); | |
const pkg = require('./package') | |
const GenerateJsonPlugin = require('generate-json-webpack-plugin') | |
const externals = [ | |
'firebase-admin', | |
'lodash' | |
] | |
const genPackage = () => ({ | |
name: 'functions', | |
private: true, | |
main: 'hello.js', | |
author:"@saphidev", | |
license: 'MIT', | |
dependencies: externals.reduce( | |
(acc, name) => | |
Object.assign({}, acc, { | |
[name]: | |
pkg.dependencies[name] || | |
pkg.devDependencies[name] | |
}), | |
{} | |
) | |
}) | |
module.exports = { | |
target: 'node', | |
resolve: { | |
mainFields: ['module', 'main'] | |
}, | |
externals: externals.reduce( | |
(acc, name) => Object.assign({}, acc, { [name]: true }), | |
{} | |
), | |
plugins: [new GenerateJsonPlugin('package.json', genPackage())] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment