nextcloud / nextcloud/server

Add dist to the search path for apps' JS and CSS code for simpler Vite config

Open
#57,846 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage enhancement
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

[!TIP]

Help move this idea forward
  • Use the 👍 reaction to show support for this feature.
  • Avoid commenting unless you have relevant information to add; unnecessary comments create noise for subscribers.
  • Subscribe to receive notifications about status changes and new comments.

Is your feature request related to a problem? Please describe.

When using Vite as a build system for apps, one has to redirect the output into the base of the project. This causes warnings by Vite, and you cannot use normal cleanup hooks. The exact Vite warning is

(!) build.outDir must not be the same directory of root or a parent directory of root as this could cause Vite to overwriting source files with build outputs.

This would also bring the structure of an app closer to the normal Vite-suggested project structure.

Of course, this needs to be done way before the library can be updated to ensure portability. Thus, I suggest to bring this soon into the NC core for it to spread until the Vite config can be adopted.

Describe the solution you'd like

I would like to extend the CSS and JS Locators to accept not only the app's /css and /js paths but the corresponding folders under /dist as well.

Describe alternatives you've considered

Keeping the workaround and accepting the warning from Vite.

Additional context

By extending the search path with lowest priority, there should be no collisions as far as I can imagine. I would be willing to provide a PR if this was considered a useful extension. I need some feedback, though, on this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue points to lib/appConfig.ts in nextcloud-vite-config as context; first locate the Nextcloud core CSS and JS locator implementations and any related tests. Extend those locators to check the corresponding dist paths with lower priority, then verify that existing paths still win and that apps using dist assets are found.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript, php, vite
Domain
frontend, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.