ice icon indicating copy to clipboard operation
ice copied to clipboard

[QUESTION]如何正确配置嵌套页面级store

Open xmsz opened this issue 3 years ago • 1 comments

DEMO: https://github.com/xmsz/demo-20220428

运行提示

 [plugin vite:dep-scan] ENOENT: no such file or directory, open '.ice/pages/Home/Layout/index.tsx'

    node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-3397b401.js:39198:43:
      39198 │                 let contents = fs__default.readFileSync(id, 'utf-8');
            ╵                                            ^

    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-3397b401.js:39198:44
    at callback (node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:981:34)
    at handleRequest (node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:709:36)
    at handleIncomingPacket (node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:756:7)
    at Socket.readFromStdout (node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:632:7)
    at Socket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)

  This error came from the "onLoad" callback registered here:

    node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-3397b401.js:39193:18:
      39193 │             build.onLoad({ filter: JS_TYPES_RE }, ({ path: id }) => {
            ╵                   ~~~~~~

    at setup (node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-3397b401.js:39193:19)
    at handlePlugins (node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:843:23)
    at Object.buildOrServe (node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1137:7)
    at node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:2079:17
    at new Promise (<anonymous>)
    at Object.build (node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:2078:14)
    at Object.build (node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1927:51)
    at node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-3397b401.js:38914:54
    at Array.map (<anonymous>)

  The plugin "vite:dep-scan" was triggered by this import

    src/routes.ts:2:23:
      2 │ import HomeLayout from '@/pages/Home/Layout'
        ╵                        ~~~~~~~~~~~~~~~~~~~~~

Build failed with 1 error:
node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-3397b401.js:39198:43: ERROR: [plugin: vite:dep-scan] ENOENT: no such file or directory, open '.ice/pages/Home/Layout/index.tsx'

  • 我先创建了Home/Layout并修改routes这个没有问题
  • 一但我创建了store.ts就会报错

xmsz avatar Apr 28 '22 12:04 xmsz

  • 如果将 vite改为false 就不会报错
  • 使用https://github.com/alibaba/ice/blob/master/examples/basic-nested-store/README.md也是会报错

xmsz avatar May 05 '22 05:05 xmsz