logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

webpack.base.conf.js (3775B)


  1. var path = require('path')
  2. var config = require('../config')
  3. var utils = require('./utils')
  4. var projectRoot = path.resolve(__dirname, '../')
  5. var ServiceWorkerWebpackPlugin = require('serviceworker-webpack5-plugin')
  6. var CopyPlugin = require('copy-webpack-plugin');
  7. var { VueLoaderPlugin } = require('vue-loader')
  8. var ESLintPlugin = require('eslint-webpack-plugin');
  9. var StylelintPlugin = require('stylelint-webpack-plugin');
  10. var env = process.env.NODE_ENV
  11. // check env & config/index.js to decide weither to enable CSS Sourcemaps for the
  12. // various preprocessor loaders added to vue-loader at the end of this file
  13. var cssSourceMapDev = (env === 'development' && config.dev.cssSourceMap)
  14. var cssSourceMapProd = (env === 'production' && config.build.productionSourceMap)
  15. var useCssSourceMap = cssSourceMapDev || cssSourceMapProd
  16. var now = Date.now()
  17. module.exports = {
  18. entry: {
  19. app: './src/main.js'
  20. },
  21. output: {
  22. path: config.build.assetsRoot,
  23. publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
  24. filename: '[name].js',
  25. chunkFilename: '[name].js'
  26. },
  27. optimization: {
  28. splitChunks: {
  29. chunks: 'all'
  30. }
  31. },
  32. resolve: {
  33. extensions: ['.mjs', '.js', '.jsx', '.vue'],
  34. modules: [
  35. path.join(__dirname, '../node_modules')
  36. ],
  37. alias: {
  38. 'static': path.resolve(__dirname, '../static'),
  39. 'src': path.resolve(__dirname, '../src'),
  40. 'assets': path.resolve(__dirname, '../src/assets'),
  41. 'components': path.resolve(__dirname, '../src/components'),
  42. 'vue-i18n': 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
  43. },
  44. fallback: {
  45. 'querystring': require.resolve('querystring-es3'),
  46. 'url': require.resolve('url/')
  47. }
  48. },
  49. module: {
  50. noParse: /node_modules\/localforage\/dist\/localforage.js/,
  51. rules: [
  52. {
  53. enforce: 'post',
  54. test: /\.(json5?|ya?ml)$/, // target json, json5, yaml and yml files
  55. type: 'javascript/auto',
  56. loader: '@intlify/vue-i18n-loader',
  57. include: [ // Use `Rule.include` to specify the files of locale messages to be pre-compiled
  58. path.resolve(__dirname, '../src/i18n')
  59. ]
  60. },
  61. {
  62. test: /\.vue$/,
  63. loader: 'vue-loader',
  64. options: {
  65. compilerOptions: {
  66. isCustomElement(tag) {
  67. if (tag === 'pinch-zoom') {
  68. return true
  69. }
  70. return false
  71. }
  72. }
  73. }
  74. },
  75. {
  76. test: /\.jsx?$/,
  77. include: projectRoot,
  78. exclude: /node_modules\/(?!tributejs)/,
  79. use: 'babel-loader'
  80. },
  81. {
  82. test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
  83. type: 'asset',
  84. generator: {
  85. filename: utils.assetsPath('img/[name].[hash:7][ext]')
  86. }
  87. },
  88. {
  89. test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
  90. type: 'asset',
  91. generator: {
  92. filename: utils.assetsPath('fonts/[name].[hash:7][ext]')
  93. }
  94. },
  95. {
  96. test: /\.mjs$/,
  97. include: /node_modules/,
  98. type: 'javascript/auto'
  99. }
  100. ]
  101. },
  102. plugins: [
  103. new ServiceWorkerWebpackPlugin({
  104. entry: path.join(__dirname, '..', 'src/sw.js'),
  105. filename: 'sw-pleroma.js'
  106. }),
  107. new ESLintPlugin({
  108. extensions: ['js', 'vue'],
  109. formatter: require('eslint-formatter-friendly')
  110. }),
  111. new StylelintPlugin({}),
  112. new VueLoaderPlugin(),
  113. // This copies Ruffle's WASM to a directory so that JS side can access it
  114. new CopyPlugin({
  115. patterns: [
  116. {
  117. from: "node_modules/@ruffle-rs/ruffle/**/*",
  118. to: "static/ruffle/[name][ext]"
  119. },
  120. ],
  121. options: {
  122. concurrency: 100,
  123. },
  124. })
  125. ]
  126. }