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

Can't use shared vite.config.ts in monorepo #6931

Closed
1 task done
Rusinas opened this issue Jan 6, 2024 · 2 comments
Closed
1 task done

Can't use shared vite.config.ts in monorepo #6931

Rusinas opened this issue Jan 6, 2024 · 2 comments
Labels
kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage owned-by: turborepo

Comments

@Rusinas
Copy link

Rusinas commented Jan 6, 2024

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

https://github.com/Rusinas/vite-shared-config-bug

What package manager are you using / does the bug impact?

npm

What operating system are you using?

Windows

Which canary version will you have in your reproduction?

1.11.3

Describe the Bug

I have a monorepo, where I've got a bunch of Vue apps and I want to share vite.config.ts across all of them. The problem is that I am getting tons of errors and I can't figure it out.

When I try to export shared config and use it, I get the following error:

failed to load config from C:\Users\andre\Desktop\Code\Stuff\vite-shared-config\apps\vue-project\vite.config.ts
error when starting dev server:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for C:\Users\andre\Desktop\Code\Stuff\vite-shared-config\packages\vite-config\src\index.ts

Interestingly enough that if I change the import statement from import { ViteConfigBase } from 'vite-config' to import { ViteConfigBase } from '../../packages/vite-config/src/vite.config.base', everything will work just fine. But that's only for dev. If I want to build it inside of a Docker container, it will fail.

Changing the file extension to .js is not helping too.

I don't know if the problem is with Vite or Turborepo, but I am kinda desperate right now and will appreciate any help.

Expected Behavior

Shared config from the package is working fine.

To Reproduce

cd apps/vue-project
npm i
npm run dev
?????
ERROR!

Additional context

No response

@Rusinas Rusinas added kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage owned-by: turborepo labels Jan 6, 2024
@chris-olszewski
Copy link
Contributor

The reproduction repo you linked to doesn't use Turborepo at all and unless the dev script in apps/vue-project/package.json invokes turbo, then your reproduction steps also don't invoke turbo. The error message you provided doesn't look like it's produced by turbo either.

Closing as I believe this is an issue with your Vite setup. Feel free to reopen with a reproduction where the failure only happens when turbo is used.

@chris-olszewski chris-olszewski closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2024
@ampcpmgp
Copy link

I ran into the same problem.
It is discussed here.

vitejs/vite#5370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage owned-by: turborepo
Projects
None yet
Development

No branches or pull requests

3 participants