-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.prod.js
More file actions
33 lines (31 loc) · 875 Bytes
/
Copy pathwebpack.prod.js
File metadata and controls
33 lines (31 loc) · 875 Bytes
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
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
// const dotenv = require('dotenv').config();
function fetchPathsFromSomeExternalSource() {
const files = fs.readdirSync(`${__dirname}/src/pieces`);
let entries = {};
files.forEach((f) => {
entries[f] = {
import: `./src/pieces/${f}`,
filename: `/pieces/${f}`
}
})
return entries;
}
module.exports = {
entry() {
return fetchPathsFromSomeExternalSource(); // returns a promise that will be resolved with something like ['src/main-layout.js', 'src/admin-layout.js']
},
output: {
path: path.join(__dirname, "build"),
filename: "[name].js" // string (default)
},
plugins: [
new webpack.DefinePlugin( {
"process.env.KEYS": JSON.stringify({
WORDNIK_API_KEY: process.env.WORDNIK_API_KEY
})
} ),
],
};