-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
44 lines (37 loc) · 1.4 KB
/
webpack.config.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
42
43
44
/* eslint-disable import/no-dynamic-require, global-require */
const path = require('path');
/**
* This is a main entrypoint for Webpack config.
* All the settings are pulled from node_modules/@eightshift/frontend-libs/webpack.
* We are loading mostly used configuration but you can always override or turn off the default setup and provide your own.
* Please referer to Eightshift-libs wiki for details.
*/
module.exports = (env, argv) => {
const projectConfig = {
config: {
projectDir: __dirname, // Current project directory absolute path.
projectPath: 'wp-content/plugins/eightshift-forms', // Project path relative to project root.
},
overrides: [
'application',
'applicationAdmin',
'applicationBlocks',
],
};
// Generate Webpack config for this project using options object.
const project = require('./node_modules/@eightshift/frontend-libs/webpack')(argv.mode, projectConfig);
return {
// Load all projects config from eightshift-frontend-libs.
...project,
output: {
// Load all output config from eightshift-frontend-libs.
...project.output,
library: 'EightshiftForms',
},
entry: {
...project.entry,
applicationAdmin: path.join(projectConfig.config.projectDir, '/src/Blocks/assets/application-admin.js'),
applicationBlocksFrontendMandatory: path.join(projectConfig.config.projectDir, '/src/Blocks/assets/application-blocks-frontend-mandatory.js'),
},
};
};