-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwebpack.server.js
41 lines (36 loc) · 869 Bytes
/
webpack.server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//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())]
}