webpack.common.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* eslint-disable camelcase */
  2. const path = require('path')
  3. const merge = require('webpack-merge')
  4. const { VueLoaderPlugin } = require('vue-loader')
  5. const core = require('./core/webpack')
  6. const accessibility = require('./apps/accessibility/webpack')
  7. const comments = require('./apps/comments/webpack')
  8. const files_sharing = require('./apps/files_sharing/webpack')
  9. const files_trashbin = require('./apps/files_trashbin/webpack')
  10. const files_versions = require('./apps/files_versions/webpack')
  11. const oauth2 = require('./apps/oauth2/webpack')
  12. const settings = require('./apps/settings/webpack')
  13. const systemtags = require('./apps/systemtags/webpack')
  14. const twofactor_backupscodes = require('./apps/twofactor_backupcodes/webpack')
  15. const updatenotifications = require('./apps/updatenotification/webpack')
  16. const workflowengine = require('./apps/workflowengine/webpack')
  17. module.exports = []
  18. .concat(
  19. core,
  20. settings,
  21. accessibility,
  22. comments,
  23. files_sharing,
  24. files_trashbin,
  25. files_versions,
  26. oauth2,
  27. systemtags,
  28. twofactor_backupscodes,
  29. updatenotifications,
  30. workflowengine
  31. )
  32. .map(config => merge.smart({
  33. module: {
  34. rules: [
  35. {
  36. test: /\.css$/,
  37. use: ['vue-style-loader', 'css-loader']
  38. },
  39. {
  40. test: /\.scss$/,
  41. use: ['vue-style-loader', 'css-loader', 'sass-loader']
  42. },
  43. {
  44. test: /\.(js|vue)$/,
  45. loader: 'eslint-loader',
  46. // no checks against vendors, modules or handlebar compiled files
  47. exclude: /node_modules|vendor|templates\.js/,
  48. enforce: 'pre',
  49. options: {
  50. // we cannot simply use the eslint binary as we
  51. // don't want to parse all the js files so let's
  52. // use it from within webpack and only check
  53. // against our compiled files
  54. fix: process.env.ESLINT_FIX === 'true'
  55. }
  56. },
  57. {
  58. test: /\.vue$/,
  59. loader: 'vue-loader',
  60. exclude: /node_modules/
  61. },
  62. {
  63. test: /\.js$/,
  64. loader: 'babel-loader',
  65. exclude: /node_modules/
  66. },
  67. {
  68. test: /\.(png|jpg|gif)$/,
  69. loader: 'url-loader',
  70. options: {
  71. name: '[name].[ext]?[hash]',
  72. limit: 8192
  73. }
  74. },
  75. {
  76. test: /\.handlebars/,
  77. loader: 'handlebars-loader',
  78. query: {
  79. extensions: '.handlebars'
  80. }
  81. }
  82. ]
  83. },
  84. plugins: [new VueLoaderPlugin()],
  85. resolve: {
  86. alias: {
  87. OC: path.resolve(__dirname, './core/src/OC'),
  88. OCA: path.resolve(__dirname, './core/src/OCA'),
  89. // make sure to use the handlebar runtime when importing
  90. handlebars: 'handlebars/runtime'
  91. },
  92. extensions: ['*', '.js', '.vue']
  93. }
  94. }, config))