webpack.common.js 948 B

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