quasarframework / quasar

Quasar Framework - Build high-performance VueJS user interfaces in record time
https://quasar.dev
MIT License
25.8k stars 3.5k forks source link

Strange behaviour of Symlinks #15654

Closed fprijate closed 1 year ago

fprijate commented 1 year ago

What happened?

In my Electron app I have two symlinked libs , one with frontend components and one with backend functions.

Frontend works only if I change one or both options in quasar config.ts:

eslint: {
      // fix: true,
      // include = [],
      // exclude = [],
      // rawOptions = {},
      warnings: false,
      errors: false,
    }

or

   extendViteConf(viteConf) {
        viteConf.resolve.preserveSymlinks = true;
      },

Whether the backend works only if I disable linting

What did you expect to happen?

That Symlinks work aut of the box

Reproduction URL

https://github.com/fprijate/quasar-test-symlinks

How to reproduce?

  1. clone repo
  2. cd test-app
  3. pnpm install
  4. create symliks (for windows there is __MAKE_LINK.BAT)
  5. npx run spa:dev ,or npx run electron:dev
  6. play with changing the settings

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Components (quasar), Project Creation (create-quasar), TypeScript Support, Electron Mode

Platforms/Browsers

No response

Quasar info output

Operating System - Windows_NT(10.0.19045) - win32/x64
NodeJs - 18.15.0

Global packages
  NPM - 9.6.2
  yarn - 1.22.19
  @quasar/cli - 2.0.0
  @quasar/icongenie - 2.5.4
  cordova - Not installed

Important local packages
  quasar - 2.11.9 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app-vite - 1.2.1 -- Quasar Framework App CLI with Vite
  @quasar/extras - 1.16.1 -- Quasar Framework fonts, icons and animations
  eslint-plugin-quasar - Not installed
  vue - 3.2.47 -- The progressive JavaScript framework for building modern web UI.
  vue-router - 4.1.6
  pinia - Not installed
  vuex - Not installed
  vite - 2.9.15 -- Native-ESM powered web dev build tool
  eslint - 8.37.0 -- An AST-based pattern checker for JavaScript.
  electron - 23.2.1 -- Build cross platform desktop apps with JavaScript, HTML, and CSS
  electron-packager - Not installed
  electron-builder - Not installed
  register-service-worker - 1.7.2 -- Script for registering service worker, with hooks
  @capacitor/core - Not installed
  @capacitor/cli - Not installed
  @capacitor/android - Not installed
  @capacitor/ios - Not installed

Quasar App Extensions
  *None installed*

Relevant log output

[plugin:quasar:eslint] C:\RAZVOJ\ELECTRON_TESTI\quasar-test-symlinks\libfront\components\LinkedComp.vue 1:1 error Parsing error: Unexpected token <

✖ 1 problem (1 error, 0 warnings) C:/RAZVOJ/ELECTRON/_TESTI/quasar-test-symlinks/libfront/components/LinkedComp.vue at formatError (C:\RAZVOJ\ELECTRON_TESTI\quasar-test-symlinks\test-app\node_modules.pnpm\vite@2.9.15_sass@1.32.12\node_modules\vite\dist\node\chunks\dep-689425f3.js:39080:46) at TransformContext.error (C:\RAZVOJ\ELECTRON_TESTI\quasar-test-symlinks\test-app\node_modules.pnpm\vite@2.9.15_sass@1.32.12\node_modules\vite\dist\node\chunks\dep-689425f3.js:39076:19) at TransformContext.transform (C:\RAZVOJ\ELECTRON_TESTI\quasar-test-symlinks\test-app\node_modules.pnpm\@quasar+app-vite@1.2.1_eslint@8.37.0_quasar@2.11.9_vue-router@4.1.6_vue@3.2.47\node_modules\@quasar\app-vite\lib\plugins\vite.eslint.js:44:14) at async Object.transform (C:\RAZVOJ\ELECTRON_TESTI\quasar-test-symlinks\test-app\node_modules.pnpm\vite@2.9.15_sass@1.32.12\node_modules\vite\dist\node\chunks\dep-689425f3.js:39317:30) at async doTransform (C:\RAZVOJ\ELECTRON_TESTI\quasar-test-symlinks\test-app\nodemodules.pnpm\vite@2.9.15

rstoenescu commented 1 year ago

Hi,

The way to go is with viteConf.resolve.preserveSymlinks = true. We can not enable this by default because it makes some assumptions that will not be correct for everyone.