Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite config file in TS format is no more supported by Vite plugin v0.7.5 #218

Closed
daniser opened this issue May 10, 2023 · 4 comments
Closed

Comments

@daniser
Copy link

daniser commented May 10, 2023

Vite Plugin Version

0.7.5

Laravel Version

10.10.0

Node Version

18.16.0

NPM Version

9.6.6

Operating System

Windows (WSL)

OS Version

10 Pro (22H2 19045.2965)

Web browser and version

Google Chrome Version 113.0.5672.93 (Official Build) (x86-64)

Running in Sail?

No

Description

TypeScript throws following error for some reason:
image

Steps To Reproduce

Use Laravel Vite plugin in Vite configuration file in TypeScript format (vite.config.ts).

@timacdonald
Copy link
Member

@daniser Could you confirm that changing your vite.config.ts it to a .js file and removing types has it working again as expected?

@daniser
Copy link
Author

daniser commented May 10, 2023

@timacdonald yes, renaming to .js helps. As alternative, you can remove it from tsconfig.json/include section - it will compile, but IDE still showing same error.
My TSConfig file:

{
    "compilerOptions": {
        "allowJs": true,
        "module": "ESNext",
        "moduleResolution": "Node",
        "jsx": "preserve",
        "strict": true,
        "isolatedModules": true,
        "target": "ESNext",
        "esModuleInterop": true,
        "experimentalDecorators": true,
        "forceConsistentCasingInFileNames": true,
        "noEmit": true,
        "skipLibCheck": true,
        "paths": {
            "@/*": ["./resources/js/*"]
        }
    },
    "include": [
        "resources/js/**/*.ts",
        "resources/js/**/*.d.ts",
        "resources/js/**/*.vue",
        "vite.config.ts"
    ]
}

@RobertBoes
Copy link

I've noticed the same issue, seems like the type exports have changed or are removed, this does work fine in a ts file:

import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';

But importing the Vite plugin (import laravel from 'laravel-vite-plugin';) will throw errors in the IDE and tsc

Cannot find module 'laravel-vite-plugin' or its corresponding type declarations.

@timacdonald
Copy link
Member

timacdonald commented May 11, 2023

This should get it sorted: #220

We'll get it tagged shortly. You could likely manually make this change in you node_modules and it should just work™️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants