【问题标题】:Vite disk cache issueVite磁盘缓存问题
【发布时间】:2022-01-04 14:42:58
【问题描述】:

我有一个项目使用vitevue 3 作为前端。它还使用eslint。有时当我运行代码时,它会抛出如下错误:

2:26:53 PM [vite] Internal server error: /path/to/project/wt-frontend-2/src/pages/school-districts/PageSsDetails.vue
46:1 error "@/assets/images/school.svg" import should occur before import of "./components/SdDoughnutChart.vue" import/order

✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the "--fix" option.

Plugin: vite:eslint
File: /path/to/project/wt-frontend-2/src/pages/school-districts/PageSsDetails.vue

at formatError (/path/to/project/wt-frontend-2/node_modules/vite/dist/node/chunks/dep-76613303.js:36769:46) at TransformContext.error (/path/to/project/wt-frontend-2/node_modules/vite/dist/node/chunks/dep-76613303.js:36765:19) at TransformContext.transform (/path/to/project/wt-frontend-2/node_modules/vite-plugin-eslint/dist/index.js:87:14) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Object.transform (/path/to/project/wt-frontend-2/node_modules/vite/dist/node/chunks/dep-76613303.js:36985:30)

但是,一旦我修复代码并保存,它就不会检测到更新的文件。 (虽然它会自动运行)。

有什么办法可以解决这个问题吗? 我尝试删除节点模块和 yarn-lock 并运行 yarn 来安装模块,但问题仍然存在。

【问题讨论】:

    标签: javascript vue.js vuejs3 rollupjs vite


    【解决方案1】:

    这似乎是带有 vite-eslint-plugin 的 known problem

    您可以使用以下行禁用 vite.cofig 文件中的缓存:

    eslintPlugin({ cache: false });
    

    【讨论】:

      猜你喜欢
      • 2014-06-12
      • 1970-01-01
      • 2015-10-01
      • 2015-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-12
      相关资源
      最近更新 更多