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

Unable to build frontend when Arches is installed with poetry, pipenv or uv #11764

Closed
danbentley opened this issue Feb 4, 2025 · 0 comments
Closed

Comments

@danbentley
Copy link

When loading templates from the Django server, the path lookup utility function ignores any path containing a dot (#11094).

This has the unintended side effect of preventing frontend build scripts from locating JavaScript files stored within an Arches instance installed in a .venvdirectory, which is favoured by the following Python dependency managers:

If Arches is installed in a virtual environment containing a dot, npm run build_development fails with the following error:

root@670418858a9a:/app# uv run npm run build_development

> build_development
> npm run eslint:check && npm run ts:check && cross-env NODE_OPTIONS=--max-old-space-size=2048 webpack --config ./webpack/webpack.config.dev.js


> eslint:check
> eslint **/src


> ts:check
> vue-tsc --noEmit

Data imported from .frontend-configuration-settings.json: {
  _comment: 'This is a generated file. Do not edit directly.',
  APP_ROOT: '/app/finds',
  APP_RELATIVE_PATH: 'finds',
  ARCHES_APPLICATIONS: [ 'finds' ],
  ARCHES_APPLICATIONS_PATHS: { finds: '/app/finds' },
  SITE_PACKAGES_DIRECTORY: '/app/.venv/lib/python3.11/site-packages',
  PUBLIC_SERVER_ADDRESS: 'http://localhost:8000/',
  ROOT_DIR: '/app/.venv/lib/python3.11/site-packages/arches',
  STATIC_URL: '/static/',
  WEBPACK_DEVELOPMENT_SERVER_PORT: 9000
}
asset js/reports/default.js 160 KiB [emitted] (name: reports/default)
asset css/themes/_project.js 2.27 KiB [compared for emit] (name: css/themes/_project)
asset css/themes/_project.css 597 bytes [compared for emit] (name: css/themes/_project)
Entrypoint reports/default 160 KiB = js/reports/default.js
Entrypoint css/themes/_project 2.85 KiB = css/themes/_project.css 597 bytes css/themes/_project.js 2.27 KiB

ERROR in ./finds/media/js/reports/default.js 
Module not found: Error: Can't resolve 'templates/views/report-templates/default.htm' in '/app/finds/media/js/reports'
resolve 'templates/views/report-templates/default.htm' in '/app/finds/media/js/reports'
  Parsed request is a module
  using description file: /app/package.json (relative path: ./finds/media/js/reports)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      looking for modules in /app/node_modules
        /app/node_modules/templates doesn't exist

ERROR in ./finds/media/js/reports/default.js 
Module not found: Error: Can't resolve 'viewmodels/report' in '/app/finds/media/js/reports'
resolve 'viewmodels/report' in '/app/finds/media/js/reports'
  Parsed request is a module
  using description file: /app/package.json (relative path: ./finds/media/js/reports)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      looking for modules in /app/node_modules
        /app/node_modules/viewmodels doesn't exist

webpack 5.97.1 compiled with 2 errors in 1244 ms

This can be remedied by amending the check for a dotfile, allowing us to skip dot files (such as .DS_Store), while allowing files held within a directory containing a dot:


        // Ignore dotfiles
        if (Path.basename(file).startsWith('.')) {
            return lookup;
        }
@chiatt chiatt added this to pipeline Feb 4, 2025
danbentley added a commit to danbentley/arches that referenced this issue Feb 4, 2025
Resolves archesproject#11764

The convention of naming a virtual environment "`.venv`" appears to have been adopted
by the above package managers.

The fix addresses the issue of templates in directories that contain a dot (specifically
for Arches installed with the above package managers) while ensuring that dotfiles, such
as macOS' .DS_Store (archesproject#11094), are ignored.
danbentley added a commit to danbentley/arches that referenced this issue Feb 4, 2025
Resolves archesproject#11764

The convention of naming a virtual environment "`.venv`" appears to have been adopted
by the above package managers.

The fix addresses the issue of templates in directories that contain a dot (specifically
for Arches installed with the above package managers) while ensuring that dotfiles, such
as macOS' .DS_Store (archesproject#11094), are ignored.
@chiatt chiatt closed this as completed Feb 7, 2025
@github-project-automation github-project-automation bot moved this to ✅ Done in pipeline Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants