webpack.base.config.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. entry: [`${clientDir}/main.js`],
  7. output: {
  8. publicPath: '/app/',
  9. },
  10. module: {
  11. rules: [
  12. {
  13. test: /\.vue$/,
  14. loader: "vue-loader"
  15. },
  16. {
  17. test: /\.js$/,
  18. loader: 'babel-loader',
  19. exclude: /node_modules/,
  20. query: {
  21. plugins: [
  22. 'syntax-dynamic-import',
  23. 'transform-decorators-legacy',
  24. 'transform-class-properties',
  25. // ["component", { "libraryName": "element-ui", "styleLibraryName": `~${clientDir}/theme` } ]
  26. ]
  27. }
  28. },
  29. {
  30. test: /\.gif$/,
  31. loader: "url-loader",
  32. options: {
  33. name: "images/[name]-[hash:6].[ext]"
  34. }
  35. },
  36. {
  37. test: /\.png$/,
  38. loader: "url-loader",
  39. options: {
  40. name: "images/[name]-[hash:6].[ext]"
  41. }
  42. },
  43. {
  44. test: /\.jpg$/,
  45. loader: "file-loader",
  46. options: {
  47. name: "images/[name]-[hash:6].[ext]"
  48. }
  49. },
  50. {
  51. test: /\.(ttf|eot|woff|woff2)$/,
  52. loader: "file-loader",
  53. options: {
  54. name: "fonts/[name]-[hash:6].[ext]"
  55. }
  56. },
  57. ]
  58. },
  59. plugins: [
  60. new VueLoaderPlugin(),
  61. ]
  62. };