webpack.dll.js 878 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const path = require("path");
  2. const webpack = require("webpack");
  3. const terserWebpackPlugin = require("terser-webpack-plugin");
  4. const {CleanWebpackPlugin} = require('clean-webpack-plugin')
  5. module.exports = {
  6. mode: "production",
  7. entry: {
  8. vue: [
  9. "@antv/data-set",
  10. "@antv/f2",
  11. "axios",
  12. "vant",
  13. "vue",
  14. "vue-axios",
  15. "vue-router",
  16. "vuex",
  17. ],
  18. },
  19. output: {
  20. path: path.resolve(__dirname, "dll"),
  21. filename: "dll_[name].js",
  22. library: "dll_[name]",
  23. },
  24. optimization: {
  25. minimizer: [
  26. new terserWebpackPlugin({
  27. extractComments: false,
  28. }),
  29. ],
  30. },
  31. plugins: [
  32. new CleanWebpackPlugin({
  33. path: path.join(__dirname, "./dll")
  34. }),
  35. new webpack.DllPlugin({
  36. name: "dll+[name]",
  37. path: path.resolve(__dirname, "./dll/[name].manifest.json"),
  38. }),
  39. ],
  40. };