webpack.base.config.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. const path = require('path');
  2. //const webpack = require('webpack');
  3. const VueLoaderPlugin = require('vue-loader/lib/plugin');
  4. const clientDir = path.resolve(__dirname, '../client');
  5. module.exports = {
  6. resolve: {
  7. fallback: {
  8. "url": false,
  9. "path": false,
  10. }
  11. },
  12. entry: [`${clientDir}/main.js`],
  13. output: {
  14. publicPath: '/app/',
  15. },
  16. module: {
  17. rules: [
  18. {
  19. test: /\.vue$/,
  20. loader: "vue-loader"
  21. },
  22. {
  23. test: /\.includer$/,
  24. resourceQuery: /^\?vue/,
  25. use: path.resolve('build/includer.js')
  26. },
  27. {
  28. test: /\.js$/,
  29. loader: 'babel-loader',
  30. exclude: /node_modules/,
  31. options: {
  32. presets: [['@babel/preset-env', { targets: { esmodules: true } }]],
  33. plugins: [
  34. ['@babel/plugin-proposal-decorators', { legacy: true }]
  35. ]
  36. }
  37. /*query: {
  38. plugins: [
  39. 'syntax-dynamic-import',
  40. 'transform-decorators-legacy',
  41. 'transform-class-properties',
  42. ]
  43. }*/
  44. },
  45. {
  46. test: /\.gif$/,
  47. loader: "url-loader",
  48. options: {
  49. name: "images/[name]-[hash:6].[ext]"
  50. }
  51. },
  52. {
  53. test: /\.png$/,
  54. loader: "url-loader",
  55. options: {
  56. name: "images/[name]-[hash:6].[ext]"
  57. }
  58. },
  59. {
  60. test: /\.jpg$/,
  61. loader: "file-loader",
  62. options: {
  63. name: "images/[name]-[hash:6].[ext]"
  64. }
  65. },
  66. {
  67. test: /\.(ttf|eot|woff|woff2)$/,
  68. loader: "file-loader",
  69. options: {
  70. name: "fonts/[name]-[hash:6].[ext]"
  71. }
  72. },
  73. ]
  74. },
  75. plugins: [
  76. new VueLoaderPlugin(),
  77. ]
  78. };