webpack.base.config.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. ]
  25. }
  26. },
  27. {
  28. test: /\.gif$/,
  29. loader: "url-loader",
  30. options: {
  31. name: "images/[name]-[hash:6].[ext]",
  32. limit: 10000
  33. }
  34. },
  35. {
  36. test: /\.png$/,
  37. loader: "url-loader",
  38. options: {
  39. name: "images/[name]-[hash:6].[ext]",
  40. limit: 10000
  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)$/,
  52. loader: "file-loader",
  53. options: {
  54. prefix: "font/"
  55. }
  56. },
  57. ]
  58. },
  59. plugins: [
  60. new VueLoaderPlugin()
  61. ]
  62. };