-
Notifications
You must be signed in to change notification settings - Fork 16
/
microsoft-webpack.config.js
35 lines (27 loc) · 1.4 KB
/
microsoft-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
// Copyright 2021-2023 Ellucian Company L.P. and its affiliates.
const dotenv = require('dotenv');
const packageJson = require('./package.json');
const extensionConfig = require('./microsoft-extension.js');
const Dotenv = require('dotenv-webpack');
dotenv.config();
const { webpackConfigBuilder } = require('@ellucian/experience-extension');
module.exports = async (env, options) => {
const additionalDotEnvFile = options.mode === 'development' ? '.env.dev' : '.env.prod';
dotenv.config({ path: additionalDotEnvFile});
// Generate Webpack configuration based on the extension.js file
// and any optional env flags ("--env verbose", "--env upload", etc)
const webpackConfig = await webpackConfigBuilder({
extensionConfig: extensionConfig,
extensionVersion: packageJson.version,
mode: options.mode || 'production',
verbose: env.verbose || process.env.EXPERIENCE_EXTENSION_VERBOSE || false,
upload: env.upload || process.env.EXPERIENCE_EXTENSION_UPLOAD || false,
forceUpload: env.forceUpload || process.env.EXPERIENCE_EXTENSION_FORCE_UPLOAD || false,
uploadToken: process.env.EXPERIENCE_EXTENSION_UPLOAD_TOKEN,
liveReload: env.liveReload || false,
port: process.env.PORT || 8082
});
// For advanced scenarios, dynamically modify webpackConfig here.
webpackConfig.plugins.push(new Dotenv());
return webpackConfig;
};