ojet.config.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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: false,
  10. port: 8000
  11. }
  12. };
  13. module.exports = {
  14. /**
  15. *
  16. * @param {object} options.context - ojet build context which contains useful fields like
  17. * buildType
  18. * @param {object} options.config - Default webpack config generated by ojet. You can
  19. * add to it, remove from it or update it using webpack-merge which was
  20. * installed alongside webpack. If desired, you can create your own config
  21. * and return it which will override the default config
  22. * @returns {object|undefined}
  23. */
  24. webpack: ({ context, config }) => {
  25. if (context.buildType === "release") {
  26. // update config with release / production options
  27. } else {
  28. // update config with development options
  29. return merge(config, developmentConfig);
  30. }
  31. // only have to return if new config object was created but
  32. // since it doesn't matter always returning the config is good
  33. // practice
  34. return config;
  35. }
  36. };