webpack.config.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. const path = require('path');
  2. const CopyPlugin = require('copy-webpack-plugin');
  3. module.exports = {
  4. entry: path.join(__dirname, './Extensions/combined/ryd.content-script.js'),
  5. output: {
  6. filename: 'bundled-content-script.js',
  7. path: path.resolve(__dirname, 'Extensions/combined')
  8. },
  9. optimization: {
  10. minimize: false
  11. },
  12. module: {
  13. rules: [
  14. {
  15. test: /\.m?js$/,
  16. exclude: /(node_modules|bower_components)/,
  17. use: {
  18. loader: 'babel-loader',
  19. options: {
  20. presets: ['@babel/preset-env'],
  21. plugins: ['@babel/plugin-proposal-object-rest-spread']
  22. }
  23. }
  24. }
  25. ]
  26. },
  27. plugins: [
  28. // exclude locale files in moment
  29. new CopyPlugin({
  30. patterns: [
  31. {
  32. from: './Extensions/combined',
  33. to: './dist/chrome',
  34. globOptions: {
  35. ignore: ['**/manifest-**', '**/dist/**', '**/src/**','**/ryd.content-script.js']
  36. }
  37. },
  38. {
  39. from: './Extensions/combined/manifest-chrome.json',
  40. to: './dist/chrome/manifest.json'
  41. },
  42. {
  43. from: './Extensions/combined',
  44. to: './dist/firefox',
  45. globOptions: {
  46. ignore: ['**/manifest-**', '**/dist/**', '**/src/**','**/ryd.content-script.js']
  47. }
  48. },
  49. {
  50. from: './Extensions/combined/manifest-firefox.json',
  51. to: './dist/firefox/manifest.json'
  52. }
  53. ]
  54. })
  55. ]
  56. };