ElMassimo / iles

🏝 The joyful site generator
https://iles.pages.dev
MIT License
1.07k stars 31 forks source link

Incompatible with `@vue/tsconfig` #138

Closed dhruvkb closed 2 years ago

dhruvkb commented 2 years ago

Description πŸ“–

When setting up iles in a project that uses @vue/tsconfig (repo), a number of errors are raised.

Errors  Files
     4  node_modules/iles/dist/client/app/composables/appConfig.ts:1
     2  node_modules/iles/dist/client/app/composables/islandDefinitions.ts:3
     1  node_modules/iles/dist/client/app/composables/reactivity.ts:1
     4  node_modules/iles/dist/client/index.ts:17
Detailed error output
``` node_modules/iles/dist/client/app/composables/appConfig.ts:1:10 - error TS1444: 'App' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled. 1 import { App, InjectionKey, inject } from 'vue' ~~~ node_modules/iles/dist/client/app/composables/appConfig.ts:1:15 - error TS1444: 'InjectionKey' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled. 1 import { App, InjectionKey, inject } from 'vue' ~~~~~~~~~~~~ node_modules/iles/dist/client/app/composables/appConfig.ts:2:1 - error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'. 2 import { AppClientConfig } from '../../shared' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/iles/dist/client/app/composables/appConfig.ts:2:10 - error TS1444: 'AppClientConfig' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled. 2 import { AppClientConfig } from '../../shared' ~~~~~~~~~~~~~~~ node_modules/iles/dist/client/app/composables/islandDefinitions.ts:3:1 - error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'. 3 import { IslandDefinition } from '../../shared' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/iles/dist/client/app/composables/islandDefinitions.ts:3:10 - error TS1444: 'IslandDefinition' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled. 3 import { IslandDefinition } from '../../shared' ~~~~~~~~~~~~~~~~ node_modules/iles/dist/client/app/composables/reactivity.ts:1:10 - error TS1444: 'Ref' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled. 1 import { Ref, reactive } from 'vue' ~~~ node_modules/iles/dist/client/index.ts:17:1 - error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'. 17 import { UserApp, GetStaticPaths, Document } from '../../types/shared' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/iles/dist/client/index.ts:17:10 - error TS1444: 'UserApp' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled. 17 import { UserApp, GetStaticPaths, Document } from '../../types/shared' ~~~~~~~ node_modules/iles/dist/client/index.ts:17:19 - error TS1444: 'GetStaticPaths' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled. 17 import { UserApp, GetStaticPaths, Document } from '../../types/shared' ~~~~~~~~~~~~~~ node_modules/iles/dist/client/index.ts:17:35 - error TS1444: 'Document' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled. 17 import { UserApp, GetStaticPaths, Document } from '../../types/shared' ~~~~~~~~ ```

Reproduction 🐞

  1. Setup an iles project as per usual.
  2. Replace the tsconfig.json file with one that extends from @vue/tsconfig.
  3. The errors appear in the node_module/iles/ directory.

Cause πŸ”

The errors are being raised because the Vue tsconfig.json file has these two directives:

Changing the regular import to type imports fixes the issue (tested locally by modifying the files inside node_modules.

ElMassimo commented 2 years ago

Closed by #139, released in iles@0.7.40. Thanks!