ElMassimo/iles

Error building iles

Opened this issue · 7 comments

ohuu commented

Hey @ElMassimo I cloned Iles over the weekend and tried to build it using build:all but I'm getting this error. Not sure exactly whats causing it, have you seen it before?

src/pwa.ts(26,3): error TS2321: Excessive stack depth comparing types '{ name: string; config(config: UserConfig): { vite: { plugins: Plugin_2[][]; }; }; configResolved({ base, prettyUrls, srcDir }: AppConfig): void; ssg: { onSiteRendered(): Promise<void>; }; }' and 'IlesModule'.
       src/pwa.ts(28,5): error TS2322: Type '(config: UserConfig) => { vite: { plugins: Plugin_2[][]; }; }' is not assignable to type '(config: UserConfig, env: ConfigEnv) => void | UserConfig | Promise<void | UserConfig | null> | null'.
         Type '{ vite: { plugins: Plugin_2[][]; }; }' is not assignable to type 'void | UserConfig | Promise<void | UserConfig | null> | null'.
           Type '{ vite: { plugins: Plugin_2[][]; }; }' is not assignable to type 'UserConfig'.
             The types of 'vite.plugins' are incompatible between these types.
               Type 'Plugin_2[][]' is not assignable to type 'PluginOption[]'.
                 Type 'Plugin_2[]' is not assignable to type 'PluginOption'.
                   Type 'Plugin_2[]' is not assignable to type 'PluginOption[]'.
                     Type 'Plugin_2' is not assignable to type 'PluginOption'.
                       Type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").Plugin' is not assignable to type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").Plugin'.
                         Types of property 'apply' are incompatible.
                           Type '"serve" | "build" | ((this: void, config: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").UserConfig, env: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined' is not assignable to type '"serve" | "build" | ((this: void, config: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").UserConfig, env: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index"...'.
                             Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
                               Type '(this: void, config: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").UserConfig, env: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").ConfigEnv) => boolean' is not assignable to type '(this: void, config: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").UserConfig, env: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").ConfigEnv) => boolean'.
                                 Types of parameters 'config' and 'config' are incompatible.
                                   Type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").UserConfig'.
                                     Types of property 'plugins' are incompatible.
                                       Type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
                                         Type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").PluginOption[]'.
                                           Type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").PluginOption'.
                                             Type 'Plugin_2' is not assignable to type 'PluginOption'.
                                               Type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").Plugin' is not assignable to type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").Plugin'.
                                                 Types of property 'apply' are incompatible.
                                                   Type '"serve" | "build" | ((this: void, config: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").UserConfig, env: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index"...' is not assignable to type '"serve" | "build" | ((this: void, config: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").UserConfig, env: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined'.
                                                     Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
                                                       Type '(this: void, config: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").UserConfig, env: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").ConfigEnv) => boolean' is not assignable to type '(this: void, config: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").UserConfig, env: import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").ConfigEnv) => boolean'.
                                                         Types of parameters 'config' and 'config' are incompatible.
                                                           Type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").UserConfig'.
                                                             Types of property 'plugins' are incompatible.
                                                               Type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
                                                                 Type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").PluginOption[]'.
                                                                   Type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.5.2/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("C:/Users/ohuu/Workspace/iles/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@17.0.45/node_modules/vite/dist/node/index").PluginOption'.
                                                                     Type 'PluginOption[]' is not assignable to type 'PluginOption'.

Error: error occured in dts build
    at Worker.<anonymous> (C:\Users\ohuu\Workspace\iles\node_modules\.pnpm\tsup@6.1.2_@swc+core@1.3.8_postcss@8.4.24_typescript@4.4.4\node_modules\tsup\dist\index.js:2073:22)
    at Worker.emit (node:events:518:28)
    at MessagePort.<anonymous> (node:internal/worker:263:53)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:826:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)
DTS Build error
Error: Failed to compile. Check the logs above.
    at error (C:\Users\ohuu\Workspace\iles\node_modules\.pnpm\rollup@2.75.7\node_modules\rollup\dist\shared\rollup.js:198:30)
    at throwPluginError (C:\Users\ohuu\Workspace\iles\node_modules\.pnpm\rollup@2.75.7\node_modules\rollup\dist\shared\rollup.js:21938:12)
    at Object.error (C:\Users\ohuu\Workspace\iles\node_modules\.pnpm\rollup@2.75.7\node_modules\rollup\dist\shared\rollup.js:22661:20)
    at Object.error (C:\Users\ohuu\Workspace\iles\node_modules\.pnpm\rollup@2.75.7\node_modules\rollup\dist\shared\rollup.js:22115:42)
    at Object.transform (C:\Users\ohuu\Workspace\iles\node_modules\.pnpm\tsup@6.1.2_@swc+core@1.3.8_postcss@8.4.24_typescript@4.4.4\node_modules\tsup\dist\rollup.js:8358:20)
    at C:\Users\ohuu\Workspace\iles\node_modules\.pnpm\rollup@2.75.7\node_modules\rollup\dist\shared\rollup.js:22870:37
 ELIFECYCLE  Command failed with exit code 1.

You need to pin Vite and Vue versions to the one used by iles. The dependencies are not getting updated. I really hope that they do, even if iles itself is inactive.

Hi Oliver, thanks for reporting!

Failures to build @islands/pwa could be related to upgrading the Vite version but not the vite-plugin-pwa version.

I have a vite-5 branch where I've updated most dependencies, but it's not yet building in its entirety (only some packages are). I intend to ship a new version, but I haven't had any spare time for this in the past few months.

Try pinning vue & vite in package.json

"overrides": {
    "vue": "3.3",
    "vite": "4.4"
},
"pnpm": {
    "overrides": {
      "vue": "3.3",
      "vite": "4.4"
    }
}
ohuu commented

Thanks all. Pinning works a treat!

ohuu commented

I have iles building locally now but I want to be able to test my changes. I guess in order to do that I'll need a test project that uses my local build of iles?

I've tried adding iles to a test project by using yarn add file:.\<path_to_iles> but that errors with this message Invalid filename: "file:.\..\..\iles-npm-0.9.5-5875663749.

Any advice on testing iles?

Adding local filepath worked for me with npm & pnpm on my Mac.

With npm, I usually install it to my test project with the full path of the project, for eg, npm install file:/Users/techakayy/projects/iles, and the test project's package.json shows it relatively like this iles: "file:../../projects/iles", (test project lives elsewhere on my drive).

With pnpm, I usually add iles: "link:../../projects/iles", to my package.json and pnpm install gets it right.

I haven't used yarn, and it might be different on Windows, sorry :-) Try yarn add <full path>!

@ElMassimo, I gave your vite-5 branch a crack and had good success, but a few minor hiccups need to be resolved, please check it out. I tried on some local projects, and dev and build worked smooth (note that I don't use client scripts in my projects). For anyone who wants to give it a shot, here is my PR: #274. Thanks! :-)