webpack.base.config.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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: /\.includer$/,
  18. resourceQuery: /^\?vue/,
  19. use: path.resolve('build/includer.js')
  20. },
  21. {
  22. test: /\.js$/,
  23. loader: 'babel-loader',
  24. exclude: /node_modules/,
  25. query: {
  26. plugins: [
  27. 'syntax-dynamic-import',
  28. 'transform-decorators-legacy',
  29. 'transform-class-properties',
  30. // ["component", { "libraryName": "element-ui", "styleLibraryName": `~${clientDir}/theme` } ]
  31. ]
  32. }
  33. },
  34. {
  35. test: /\.gif$/,
  36. loader: "url-loader",
  37. options: {
  38. name: "images/[name]-[hash:6].[ext]"
  39. }
  40. },
  41. {
  42. test: /\.png$/,
  43. loader: "url-loader",
  44. options: {
  45. name: "images/[name]-[hash:6].[ext]"
  46. }
  47. },
  48. {
  49. test: /\.jpg$/,
  50. loader: "file-loader",
  51. options: {
  52. name: "images/[name]-[hash:6].[ext]"
  53. }
  54. },
  55. {
  56. test: /\.(ttf|eot|woff|woff2)$/,
  57. loader: "file-loader",
  58. options: {
  59. name: "fonts/[name]-[hash:6].[ext]"
  60. }
  61. },
  62. ]
  63. },
  64. plugins: [
  65. new VueLoaderPlugin(),
  66. ]
  67. };