webpack.base.config.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. const path = require('path');
  2. const DefinePlugin = require('webpack').DefinePlugin;
  3. const { VueLoaderPlugin } = require('vue-loader');
  4. const clientDir = path.resolve(__dirname, '../client');
  5. module.exports = {
  6. resolve: {
  7. alias: {
  8. ws: false,
  9. //vue: '@vue/compat'
  10. }
  11. },
  12. entry: [`${clientDir}/main.js`],
  13. output: {
  14. publicPath: '/app/',
  15. clean: true
  16. },
  17. module: {
  18. rules: [
  19. {
  20. test: /\.vue$/,
  21. loader: 'vue-loader',
  22. /*options: {
  23. compilerOptions: {
  24. compatConfig: {
  25. MODE: 2
  26. }
  27. }
  28. }*/
  29. },
  30. {
  31. test: /\.js$/,
  32. loader: 'babel-loader',
  33. exclude: /node_modules/,
  34. options: {
  35. presets: [['@babel/preset-env', { targets: { esmodules: true } }]],
  36. plugins: [
  37. ['@babel/plugin-proposal-decorators', { legacy: true }]
  38. ]
  39. }
  40. },
  41. {
  42. test: /\.(gif|png)$/,
  43. type: 'asset/inline',
  44. },
  45. {
  46. test: /\.jpg$/,
  47. type: 'asset/resource',
  48. generator: {
  49. filename: 'images/[name]-[hash:6][ext]'
  50. },
  51. },
  52. {
  53. test: /\.(ttf|eot|woff|woff2)$/,
  54. type: 'asset/resource',
  55. generator: {
  56. filename: 'fonts/[name]-[hash:6][ext]'
  57. },
  58. },
  59. ]
  60. },
  61. plugins: [
  62. new DefinePlugin({
  63. __VUE_OPTIONS_API__: true,
  64. __VUE_PROD_DEVTOOLS__: false,
  65. __QUASAR_SSR__: false,
  66. __QUASAR_SSR_SERVER__: false,
  67. __QUASAR_SSR_CLIENT__: false,
  68. __QUASAR_VERSION__: false,
  69. }),
  70. new VueLoaderPlugin(),
  71. ]
  72. };