webpack.common.js 1.0 KB

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