webpack.common.js 1020 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const VueLoaderPlugin = require("vue-loader/lib/plugin");
  2. const WebpackMd5Hash = require("webpack-md5-hash");
  3. const HtmlWebpackPlugin = require("html-webpack-plugin");
  4. module.exports = {
  5. entry: "./main.js",
  6. output: {
  7. path: __dirname + "/dist/build/",
  8. filename: "[name].[hash].js"
  9. },
  10. plugins: [
  11. new VueLoaderPlugin(),
  12. new WebpackMd5Hash(),
  13. new HtmlWebpackPlugin({
  14. hash: true,
  15. template: "dist/index.tpl.html",
  16. inject: "body",
  17. filename: "index.html"
  18. })
  19. ],
  20. module: {
  21. rules: [
  22. {
  23. enforce: "pre",
  24. test: /\.vue$/,
  25. loader: "eslint-loader",
  26. exclude: /node_modules/
  27. },
  28. {
  29. test: /\.vue$/,
  30. loader: "vue-loader",
  31. exclude: /node_modules/
  32. },
  33. {
  34. enforce: "pre",
  35. test: /\.js$/,
  36. loader: "eslint-loader",
  37. exclude: /node_modules/
  38. },
  39. {
  40. test: /\.js$/,
  41. loader: "babel-loader",
  42. exclude: /node_modules/
  43. },
  44. {
  45. test: /\.scss$/,
  46. exclude: /node_modules/,
  47. use: ["vue-style-loader", "css-loader", "sass-loader"]
  48. }
  49. ]
  50. }
  51. };