shopware-cli
shopware-cli copied to clipboard
feat: introduce remote loader for missing files with esbuild
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:
- [x] Support
src/...and@administration/imports in Administration and importing inside that file other files. - [x] Add Support for
src/...imports in the Storefront and importing inside that file other files. - [x] Add Support for SCSS files in the Administration
- [ ] Rewrite SaaS Plugin to use also remote loader
- [x] Add proper caching for the downloads
- [x] 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'
- [ ] Allow partial loading of dependencies aka:
- [ ] Integration into existing code