webpack.config.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. { source: "./Extensions/combined/dist/bundled-content-script.js", destination: "./Extensions/combined/dist/firefox/bundled-content-script.js" },
  60. { source: "./Extensions/combined/dist/bundled-content-script.js", destination: "./Extensions/combined/dist/chrome/bundled-content-script.js" },
  61. ],
  62. },
  63. },
  64. }),
  65. ],
  66. };