webpack.base.config.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. limit: 10000
  35. }
  36. },
  37. {
  38. test: /\.png$/,
  39. loader: "url-loader",
  40. options: {
  41. name: "images/[name]-[hash:6].[ext]",
  42. limit: 10000
  43. }
  44. },
  45. {
  46. test: /\.jpg$/,
  47. loader: "file-loader",
  48. options: {
  49. name: "images/[name]-[hash:6].[ext]"
  50. }
  51. },
  52. {
  53. test: /\.(ttf|eot|woff)$/,
  54. loader: "file-loader",
  55. options: {
  56. prefix: "font/"
  57. }
  58. },
  59. ]
  60. },
  61. plugins: [
  62. new VueLoaderPlugin(),
  63. ]
  64. };