vue.config.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. const { defineConfig } = require("@vue/cli-service");
  2. const linariaLessLoader = require("@queenjs/webpack-loader/linaria-loader");
  3. const modifyVars = require("./src/styles/theme-antd");
  4. const path = require("path");
  5. // const publicPath =
  6. // process.env.NODE_ENV === "production"
  7. // ? `//infishwaibao.oss-cn-chengdu.aliyuncs.com/cloud/v1/`
  8. // : "./";
  9. const publicPath = "./";
  10. //
  11. module.exports = defineConfig({
  12. pages: {
  13. index: "src/pages/website/main.ts",
  14. frame3d: "src/pages/frame3d/main.ts"
  15. },
  16. outputDir: "static",
  17. publicPath: publicPath,
  18. transpileDependencies: true,
  19. chainWebpack: (config) => {
  20. const tsRule = config.module.rule("ts");
  21. tsRule
  22. .use("moduse-loader")
  23. .loader("moduse/webpack-loader")
  24. .options({
  25. include: [
  26. path.resolve(__dirname, "./src/modules"),
  27. path.resolve(__dirname, "./src/modules-ctx"),
  28. path.resolve(__dirname, "./src/modules-package"),
  29. path.resolve(__dirname, "./node_modules/@queenjs-modules"),
  30. ],
  31. });
  32. const tsxRule = config.module.rule("tsx");
  33. tsxRule.uses.store.delete("thread-loader");
  34. tsxRule
  35. .use("@linaria/webpack-loader")
  36. .loader("@linaria/webpack-loader")
  37. .options({
  38. // 将.css文件更名为.less
  39. extension: ".linaria.less",
  40. preprocessor: linariaLessLoader("@/styles/theme"),
  41. })
  42. .before("ts-loader");
  43. },
  44. css: {
  45. loaderOptions: {
  46. less: {
  47. lessOptions: {
  48. modifyVars,
  49. javascriptEnabled: true,
  50. },
  51. },
  52. },
  53. },
  54. });