webpack.base.config.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. const path = require("path");
  2. const webpack = require("webpack");
  3. const VueLoaderPlugin = require('vue-loader/lib/plugin');
  4. module.exports = {
  5. entry: [path.resolve(__dirname, '../client/main.js')],
  6. output: {
  7. path: path.resolve(__dirname, '../server/public/app'),
  8. publicPath: '/app/',
  9. filename: 'bundle.js'
  10. },
  11. module: {
  12. rules: [
  13. // это будет применяться к файлам `.js`
  14. // А ТАКЖЕ к секциям `<script>` внутри файлов `.vue`
  15. {
  16. test: /\.js$/,
  17. loader: 'babel-loader',
  18. exclude: /node_modules/,
  19. query: {
  20. plugins: [
  21. 'syntax-dynamic-import',
  22. 'transform-decorators-legacy',
  23. 'transform-class-properties',
  24. ["component", { "libraryName": "element-ui", "styleLibraryName": "~client/theme" } ]
  25. ]
  26. }
  27. },
  28. {
  29. test: /\.gif$/,
  30. loader: "url-loader",
  31. options: {
  32. name: "images/[name]-[hash:6].[ext]",
  33. limit: 10000
  34. }
  35. },
  36. {
  37. test: /\.png$/,
  38. loader: "url-loader",
  39. options: {
  40. name: "images/[name]-[hash:6].[ext]",
  41. limit: 10000
  42. }
  43. },
  44. {
  45. test: /\.jpg$/,
  46. loader: "file-loader",
  47. options: {
  48. name: "images/[name]-[hash:6].[ext]"
  49. }
  50. },
  51. {
  52. test: /\.(ttf|eot|woff)$/,
  53. loader: "file-loader",
  54. options: {
  55. prefix: "font/"
  56. }
  57. },
  58. ]
  59. },
  60. plugins: [
  61. new VueLoaderPlugin()
  62. ]
  63. };