webpack.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. mode: "development",
  7. devtool: "inline-source-map",
  8. output: {
  9. path: `${__dirname}/dist/build/`,
  10. filename: "[name].[hash].js"
  11. },
  12. plugins: [
  13. new VueLoaderPlugin(),
  14. new WebpackMd5Hash(),
  15. new HtmlWebpackPlugin({
  16. hash: true,
  17. template: "dist/index.tpl.html",
  18. inject: "body",
  19. filename: "index.html"
  20. })
  21. ],
  22. module: {
  23. rules: [
  24. {
  25. test: /\.vue$/,
  26. loader: "vue-loader",
  27. exclude: /node_modules/
  28. },
  29. {
  30. test: /\.js$/,
  31. loader: "babel-loader",
  32. exclude: /node_modules/
  33. },
  34. {
  35. test: /\.scss$/,
  36. exclude: /node_modules/,
  37. use: ["vue-style-loader", "css-loader", "sass-loader"]
  38. }
  39. ]
  40. },
  41. resolve: {
  42. alias: {
  43. vue: "vue/dist/vue.js",
  44. styles: "styles"
  45. }
  46. },
  47. devServer: {
  48. contentBase: "./dist/",
  49. historyApiFallback: true,
  50. hot: true,
  51. port: 80,
  52. public: "http://localhost",
  53. watchOptions: {
  54. aggregateTimeout: 300,
  55. poll: 1000
  56. },
  57. host: "0.0.0.0",
  58. disableHostCheck: true
  59. }
  60. };