ojet.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. Copyright (c) 2015, 2022, Oracle and/or its affiliates.
  3. Licensed under The Universal Permissive License (UPL), Version 1.0
  4. as shown at https://oss.oracle.com/licenses/upl/
  5. */
  6. const merge = require("webpack-merge").merge;
  7. const developmentConfig = {
  8. devServer: {
  9. https: true
  10. }
  11. };
  12. module.exports = {
  13. /**
  14. *
  15. * @param {object} options.context - ojet build context which contains useful fields like
  16. * buildType
  17. * @param {object} options.config - Default webpack config generated by ojet. You can
  18. * add to it, remove from it or update it using webpack-merge which was
  19. * installed alongside webpack. If desired, you can create your own config
  20. * and return it which will override the default config
  21. * @returns {object|undefined}
  22. */
  23. webpack: ({ context, config }) => {
  24. if (context.buildType === "release") {
  25. // update config with release / production options
  26. } else {
  27. // update config with development options
  28. return merge(config, developmentConfig);
  29. }
  30. // only have to return if new config object was created but
  31. // since it doesn't matter always returning the config is good
  32. // practice
  33. return config;
  34. }
  35. };