webpack.config.renderer.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* eslint-disable */
  2. const {
  3. getConfig,
  4. applyEntries,
  5. getBaseConfig,
  6. dev,
  7. } = require('./webpack.config.base');
  8. const { join } = require('path');
  9. const HtmlWebpackPlugin = require('html-webpack-plugin');
  10. const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
  11. const webpack = require('webpack');
  12. /* eslint-enable */
  13. const PORT = 4444;
  14. const appConfig = getConfig(getBaseConfig('app'), {
  15. target: 'web',
  16. devServer: {
  17. contentBase: join(__dirname, 'build'),
  18. port: PORT,
  19. hot: true,
  20. inline: true,
  21. disableHostCheck: true,
  22. },
  23. plugins: dev
  24. ? [
  25. new webpack.HotModuleReplacementPlugin(),
  26. new ReactRefreshWebpackPlugin(),
  27. ]
  28. : [],
  29. });
  30. const extPopupConfig = getConfig({
  31. target: 'web',
  32. entry: {},
  33. output: {},
  34. });
  35. applyEntries(appConfig, [
  36. ...(process.env.ENABLE_AUTOFILL ? ['form-fill', 'credentials'] : []),
  37. 'app',
  38. 'permissions',
  39. 'auth',
  40. 'find',
  41. 'menu',
  42. 'search',
  43. 'preview',
  44. 'tabgroup',
  45. 'downloads-dialog',
  46. 'add-bookmark',
  47. 'zoom',
  48. 'settings',
  49. 'history',
  50. 'newtab',
  51. 'bookmarks',
  52. ]);
  53. if (process.env.ENABLE_EXTENSIONS) {
  54. extPopupConfig.entry['extension-popup'] = [
  55. `./src/renderer/views/extension-popup`,
  56. ];
  57. extPopupConfig.plugins.push(
  58. new HtmlWebpackPlugin({
  59. title: 'Wexond',
  60. template: 'static/pages/extension-popup.html',
  61. filename: `extension-popup.html`,
  62. chunks: [`vendor.app`, 'extension-popup'],
  63. }),
  64. );
  65. module.exports = [appConfig, extPopupConfig];
  66. } else {
  67. module.exports = appConfig;
  68. }