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 #15520

Closed
7 tasks done
Rusinas opened this issue Jan 6, 2024 · 1 comment
Closed
7 tasks done

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

Rusinas opened this issue Jan 6, 2024 · 1 comment

Comments

@Rusinas
Copy link

Rusinas commented Jan 6, 2024

Describe the bug

I have a monorepo (turborepo), 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.

Reproduction

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

Steps to reproduce

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

System Info

System:
    OS: Windows 11 10.0.22621
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 1.68 GB / 15.85 GB
  Binaries:
    Node: 21.2.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (120.0.2210.91)
    Internet Explorer: 11.0.22621.1

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red
Copy link
Member

Duplicate of #5370

@sapphi-red sapphi-red marked this as a duplicate of #5370 Jan 7, 2024
@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants