-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
33 lines (29 loc) · 800 Bytes
/
webpack.config.js
File metadata and controls
33 lines (29 loc) · 800 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 webpack = require('webpack');
const dotenv = require('dotenv').config();
function fetchPathsFromSomeExternalSource() {
const files = fs.readdirSync(`${__dirname}/src/pieces`);
let entries = {};
files.forEach((f) => {
if(f.split(".").length == 2) {
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: {
filename: "[name].js", // string (default)
},
plugins: [
new webpack.DefinePlugin( {
"process.env.KEYS": JSON.stringify(dotenv.parsed)
} ),
],
};