You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This allows me to refer to models in the shared directory using the @models/ alias.
As far as I understand, I must add these aliases to the vite.config.ts as well, and so I did.
This does not work in any *.vue files. It does expectedly work in *.ts files (as well as in the vite config itself as evident by the aliases used in the additional scss data), such as the entry point for the vue application, but not in App.vue or any other vue source file that utilizes <script setup lang="ts"></script>
I tried using path.join and fileURLToPath instead of path.resolve, as well as messing around with the order in which these aliases are defined, but did not fix the problem.
I've also attempted to use npm workspaces to manage the local dependency on the shared directory, but that hasn't exactly worked out either (or I'm missing something obvious).
I've supplied the reproduction repository, but I'm kinda uncertain if it's the absolutely the most minimal reproduction of the issue. For some odd reason, it does kind of work inconsistently when building the project, but not when simply running vite on its own.
I went through the discussions page and other issues and found some on the internet as well, but none of the fixes and solutions I found worked.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Related plugins
plugin-vue
plugin-vue-jsx
Describe the bug
My project structure is the following
in
client/
I have the following (amongst other omitted settings) in mytsconfig.json
This allows me to refer to models in the shared directory using the
@models/
alias.As far as I understand, I must add these aliases to the
vite.config.ts
as well, and so I did.This does not work in any
*.vue
files. It does expectedly work in*.ts
files (as well as in the vite config itself as evident by the aliases used in the additional scss data), such as the entry point for the vue application, but not inApp.vue
or any other vue source file that utilizes<script setup lang="ts"></script>
I tried using
path.join
andfileURLToPath
instead ofpath.resolve
, as well as messing around with the order in which these aliases are defined, but did not fix the problem.I've also attempted to use
npm workspaces
to manage the local dependency on theshared
directory, but that hasn't exactly worked out either (or I'm missing something obvious).I've supplied the reproduction repository, but I'm kinda uncertain if it's the absolutely the most minimal reproduction of the issue. For some odd reason, it does kind of work inconsistently when building the project, but not when simply running
vite
on its own.I went through the discussions page and other issues and found some on the internet as well, but none of the fixes and solutions I found worked.
Reproduction
https://github.com/ClayCore/vite-vue-reproduction
Steps to reproduce
yarn install
in the root directory of the project.yarn run dev
in the/packages/client
directory.vite
in the browser.System Info
Used Package Manager
yarn
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: