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

feat: introduce remote loader for missing files with esbuild #274

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shyim
Copy link
Member

@shyim shyim commented Dec 12, 2023

Right now the Users get a Could not resolve message when they import an Administration or Storefront JS / CSS file with esbuild like this:

✘ [ERROR] Could not resolve "@administration/app/service/search-ranking.service"

    ../Resources/app/administration/src/module/sw-quote/default-search-configuration.ts:3:35:
      3 │ import { searchRankingPoint } from "@administration/app/service/search-ranking.service";
        ╵                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@administration/app/service/search-ranking.service" as external to exclude
  it from the bundle, which will remove this error and leave the unresolved path in the bundle.

These problems can be solved by using the Globals only in the Administration and for Storefront using the Frosh Storefront SDK. But Developers are lazy and adopt it very slowly.

Therefore, with this PR we add a remote loader, which fetches the missing files from GitHub and caches them locally. After this change Storefront and Administration compilation should require no change to the plugin source code base.

Open Todos:

  • Support src/... and @administration/ imports in Administration and importing inside that file other files.
  • Add Support for src/... imports in the Storefront and importing inside that file other files.
  • Add Support for SCSS files in the Administration
  • Rewrite SaaS Plugin to use also remote loader
  • Add proper caching for the downloads
  • Use minimum supported Shopware version for loading the remote files.
  • Support loading dependencies of core files without having node_modules locally
    • Allow partial loading of dependencies aka: import test from 'lodash/flow'
  • Integration into existing code

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.

1 participant