webpack.config.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. const path = require("path");
  2. const CopyPlugin = require("copy-webpack-plugin");
  3. const FileManagerPlugin = require("filemanager-webpack-plugin");
  4. module.exports = {
  5. entry: path.join(__dirname, "./Extensions/combined/ryd.content-script.js"),
  6. output: {
  7. filename: "bundled-content-script.js",
  8. path: path.resolve(__dirname, "Extensions/combined/dist"),
  9. clean: true,
  10. },
  11. optimization: {
  12. minimize: false,
  13. },
  14. watchOptions: {
  15. ignored: "./Extensions/combined/dist/*",
  16. },
  17. plugins: [
  18. // exclude locale files in moment
  19. new CopyPlugin({
  20. patterns: [
  21. {
  22. from: "./Extensions/combined",
  23. to: "./chrome",
  24. globOptions: {
  25. ignore: [
  26. "**/manifest-**",
  27. "**/dist/**",
  28. "**/src/**",
  29. "**/ryd.content-script.js",
  30. ],
  31. },
  32. },
  33. {
  34. from: "./Extensions/combined/manifest-chrome.json",
  35. to: "./chrome/manifest.json",
  36. },
  37. {
  38. from: "./Extensions/combined",
  39. to: "./firefox",
  40. globOptions: {
  41. ignore: [
  42. "**/manifest-**",
  43. "**/dist/**",
  44. "**/src/**",
  45. "**/ryd.content-script.js",
  46. ],
  47. },
  48. },
  49. {
  50. from: "./Extensions/combined/manifest-firefox.json",
  51. to: "./firefox/manifest.json",
  52. },
  53. ],
  54. }),
  55. new FileManagerPlugin({
  56. events: {
  57. onEnd: {
  58. copy: [
  59. {
  60. source: "./Extensions/combined/dist/bundled-content-script.js",
  61. destination:
  62. "./Extensions/combined/dist/firefox/bundled-content-script.js",
  63. },
  64. {
  65. source: "./Extensions/combined/dist/bundled-content-script.js",
  66. destination:
  67. "./Extensions/combined/dist/chrome/bundled-content-script.js",
  68. },
  69. ],
  70. },
  71. },
  72. }),
  73. ],
  74. };