Skip to content

fix(app-vite): local import of extensions in windows #17795

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

Closed

Conversation

lvf23
Copy link

@lvf23 lvf23 commented Jan 28, 2025

  • Possibly fix the issue documented here:

"There have been many reports of problems linking via file: and link:. This is outside of Quasar’s reach, but is likely to do with your development environment, aka your mileage with Windows will vary."

https://quasar.dev/app-extensions/development-guide/introduction#manually-testing

  • Now it's possible to load Quasar App Extensions without host in platforms like Github, Gitlab, etc.

  • Fix errors like for local Quasar App Extension:

App • ⚠️ App Extension "[ext-name]" has missing index script...

  • Tested in Windows 10 with local Quasar App Extension

What kind of change does this PR introduce?

  • Bugfix
  • Refactor
  • Feature
  • Documentation
  • Code style update
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

The PR fulfills these requirements:

  • It's submitted to the dev branch (or v[X] branch)
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix: #xxx[,#xxx], where "xxx" is the issue number)
  • It's been tested on a Cordova (iOS, Android) app
  • It's been tested on an Electron app
  • Any necessary documentation has been added or updated in the docs or explained in the PR's description.

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to start a new feature discussion first and wait for approval before working on it)

Other information:

Any adaptation needed do not hesitate to call me. I could adjust it or give more feedback. Feel free to edit according to the better fit for the project.

- Possibly fix the issue documented here:

"There have been many reports of problems linking via file: and link:. This is outside of Quasar’s reach, but is likely to do with your development environment, aka your mileage with Windows will vary."

https://quasar.dev/app-extensions/development-guide/introduction#manually-testing

- Now it's possible to load Quasar App Extensions without host in platforms like Github, Gitlab, etc.

- Fix errors like for local Quasar App Extension:

App • ⚠️  App Extension "[ext-name]" has missing index script...

- Tested in Windows 10 with local Quasar App Extension
@DouglasCalora
Copy link

I'm having this issue on linux, I used your code and fixed for me too! Any news on this PR?

@felipejuzo02
Copy link

Up! I made the change according to your code and it worked. Any predictions for seeing this PR?

@caiotarifa
Copy link

@rstoenescu we need it, could you consider merging?

@yusufkandemir
Copy link
Member

Superseded by #18003.

@lvf23 @DouglasCalora @felipejuzo02 @caiotarifa, please test the changes in #18003 and verify the new solution works for you.

@yusufkandemir
Copy link
Member

yusufkandemir commented May 12, 2025

Closing this PR as it has been superseded. Thanks for contributing @lvf23.

A simple feedback: you removed the only usage of this.#packagePath, but didn't remove the logic around it as well, so this PR wasn't complete in terms of code quality.

@DouglasCalora
Copy link

@yusufkandemir How can I test it? Directly in my node_modules like I did before or is there a better way?

@yusufkandemir
Copy link
Member

@DouglasCalora, directly modifying node_modules like you did before is sufficient

@lvf23
Copy link
Author

lvf23 commented May 12, 2025

@yusufkandemir, glad to help! Thanks for feedback! Will try to improve the code quality next time. Thank you!

@DouglasCalora
Copy link

@yusufkandemir done!

@DouglasCalora
Copy link

@lvf23 Consegue testar no seu ambiente windows pra ver se resolver o pr dele?

@lvf23
Copy link
Author

lvf23 commented May 13, 2025

@DouglasCalora, @yusufkandemir, the PR looks like its working, testing from the PR #18003

Downloading the quasar and the PR branch of the fix and linking it locally in my quasar-project:

Lucas@windows-10 MINGW64 ~/Projetos/quasar ((4b0da4c7c...))
$ git status
HEAD detached at upstream/fix-ae-script-path-resolution
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   ui/lang/index.json

no changes added to commit (use "git add" and/or "git commit -a")

Installing and compiling with pnpm:

$ pnpm install
$ pnpm build

Linking with local quasar packages (from quasar-project):

$ pnpm install ../quasar
$ pnpm install ../quasar/app-vite

The package.json of quasar-project:

{
  "name": "quasar-project",
  "version": "0.0.1",
  "description": "A Quasar Project",
  "productName": "Quasar App",
  "author": "Lucas Vendramini <[email protected]>",
  "type": "module",
  "private": true,
  "scripts": {
    "lint": "eslint -c ./eslint.config.js \"./src*/**/*.{js,cjs,mjs,vue}\"",
    "format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
    "test": "echo \"No test specified\" && exit 0",
    "dev": "quasar dev",
    "build": "quasar build",
    "postinstall": "quasar prepare"
  },
  "dependencies": {
    "@quasar/extras": "^1.16.4",
    "quasar": "^2.16.0",
    "quasar-monorepo": "link:..\\quasar",
    "vue": "^3.4.18",
    "vue-router": "^4.0.0"
  },
  "devDependencies": {
    "@eslint/js": "^9.14.0",
    "@quasar/app-vite": "link:..\\quasar\\app-vite",
    "@vue/eslint-config-prettier": "^10.1.0",
    "autoprefixer": "^10.4.2",
    "eslint": "^9.14.0",
    "eslint-plugin-vue": "^9.30.0",
    "globals": "^15.12.0",
    "postcss": "^8.4.14",
    "prettier": "^3.3.3",
    "quasar-app-extension-my-ext": "file:../quasar-app-extension-my-ext",
    "vite-plugin-checker": "^0.9.0"
  },
  "engines": {
    "node": "^28 || ^26 || ^24 || ^22 || ^20 || ^18",
    "npm": ">= 6.13.4",
    "yarn": ">= 1.21.1"
  }
}

Here is the index of my dummy quasar app extension, i just added a dummy test that was installed before in quasar-project following the instructions in https://quasar.dev/app-extensions/development-guide/introduction#manually-testing:

/**
 * Quasar App Extension index/runner script
 * (runs on each dev/build)
 *
 * Docs: https://quasar.dev/app-extensions/development-guide/index-api
 */

export default function (api) {
  //

  console.log('hello!');
}

Output of quasar-project after installing a dummy quasar app extension my app

Lucas@windows-10 MINGW64 ~/Projetos/quasar-project (main)
$ npm run dev
npm warn Unknown project config "shamefully-hoist". This will stop working in the next major version of npm.
npm warn Unknown project config "strict-peer-dependencies". This will stop working in the next major version of npm.
npm warn Unknown project config "resolution-mode". This will stop working in the next major version of npm.

> [email protected] dev
> quasar dev


 .d88888b.
d88P" "Y88b
888     888
888     888 888  888  8888b.  .d8888b   8888b.  888d888
888     888 888  888     "88b 88K          "88b 888P"
888 Y8b 888 888  888 .d888888 "Y8888b. .d888888 888
Y88b.Y8b88P Y88b 888 888  888      X88 888  888 888
 "Y888888"   "Y88888 "Y888888  88888P' "Y888888 888
       Y8b

 App • Using quasar.config.js in "esm" format
 App • Running "my-ext" Quasar App Extension...
hello!

 » Reported at............ 13/05/2025 20:08:26
 » App dir................ C:\Users\Lucas\Projetos\quasar-project
 » App URL................ http://192.168.1.10:9000/
                           http://localhost:9000/
 » Dev mode............... spa
 » Pkg quasar............. v2.18.1
 » Pkg @quasar/app-vite... v2.2.0
 » Browser target......... es2022|firefox115|chrome115|safari14

 App • Opening default browser at http://localhost:9000/

Now, if I back to original package.json of dummy quasar-project and run npm install:

{
  "name": "quasar-project",
  "version": "0.0.1",
  "description": "A Quasar Project",
  "productName": "Quasar App",
  "author": "Lucas Vendramini <[email protected]>",
  "type": "module",
  "private": true,
  "scripts": {
    "lint": "eslint -c ./eslint.config.js \"./src*/**/*.{js,cjs,mjs,vue}\"",
    "format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
    "test": "echo \"No test specified\" && exit 0",
    "dev": "quasar dev",
    "build": "quasar build",
    "postinstall": "quasar prepare"
  },
  "dependencies": {
    "@quasar/extras": "^1.16.4",
    "quasar": "^2.16.0",
    "vue": "^3.4.18",
    "vue-router": "^4.0.0"
  },
  "devDependencies": {
    "@eslint/js": "^9.14.0",
    "@quasar/app-vite": "^2.1.0",
    "@vue/eslint-config-prettier": "^10.1.0",
    "autoprefixer": "^10.4.2",
    "eslint": "^9.14.0",
    "eslint-plugin-vue": "^9.30.0",
    "globals": "^15.12.0",
    "postcss": "^8.4.14",
    "prettier": "^3.3.3",
    "quasar-app-extension-my-ext": "file:../quasar-app-extension-my-ext",
    "vite-plugin-checker": "^0.9.0"
  },
  "engines": {
    "node": "^28 || ^26 || ^24 || ^22 || ^20 || ^18",
    "npm": ">= 6.13.4",
    "yarn": ">= 1.21.1"
  }
}

This error comes back:

Lucas@windows-10 MINGW64 ~/Projetos/quasar-project (main)
$ npm install
npm warn Unknown project config "shamefully-hoist". This will stop working in the next major version of npm.
npm warn Unknown project config "strict-peer-dependencies". This will stop working in the next major version of npm.
npm warn Unknown project config "resolution-mode". This will stop working in the next major version of npm.

> [email protected] postinstall
> quasar prepare


 .d88888b.
d88P" "Y88b
888     888
888     888 888  888  8888b.  .d8888b   8888b.  888d888
888     888 888  888     "88b 88K          "88b 888P"
888 Y8b 888 888  888 .d888888 "Y8888b. .d888888 888
Y88b.Y8b88P Y88b 888 888  888      X88 888  888 888
 "Y888888"   "Y88888 "Y888888  88888P' "Y888888 888
       Y8b

 App • Using quasar.config.js in "esm" format

 App • ⚠️  App Extension "my-ext" has missing index script...

npm error code 1
npm error path C:\Users\Lucas\Projetos\quasar-project
npm error command failed
npm error command C:\Windows\system32\cmd.exe /d /s /c quasar prepare
npm error A complete log of this run can be found in: C:\Users\Lucas\AppData\Local\npm-cache\_logs\2025-05-13T23_25_18_205Z-debug-0.log

Based on the provided examples, in Windows 10, everything seems to be working properly in this PR.

P.S.: I observed that the error of link:/file:, described in quasar docs, that pnpm uses link: and npm uses file:, if you use pnpm to install the local packages and then use npm to run scripts, npm would not be able to handle link: references. So, you need to replace link: to file: in order to 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

Successfully merging this pull request may close these issues.

5 participants