| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- /**
- Copyright (c) 2015, 2022, Oracle and/or its affiliates.
- Licensed under The Universal Permissive License (UPL), Version 1.0
- as shown at https://oss.oracle.com/licenses/upl/
- */
- const package = require("./package.json");
- const merge = require("webpack-merge").merge;
- const developmentConfig = {
- devServer: {
- https: false,
- port: 8000,
- allowedHosts: [
- "localhost",
- package.config.host
- ]
- }
- };
- module.exports = {
- /**
- *
- * @param {object} options.context - ojet build context which contains useful fields like
- * buildType
- * @param {object} options.config - Default webpack config generated by ojet. You can
- * add to it, remove from it or update it using webpack-merge which was
- * installed alongside webpack. If desired, you can create your own config
- * and return it which will override the default config
- * @returns {object|undefined}
- */
- webpack: ({ context, config }) => {
- if (context.buildType === "release") {
- // update config with release / production options
- } else {
- // update config with development options
- return merge(config, developmentConfig);
- }
- // only have to return if new config object was created but
- // since it doesn't matter always returning the config is good
- // practice
- return config;
- }
- };
|