cli
cli copied to clipboard
Allow prefixes for packages
I'm submitting a feature request
Please tell us about your environment:
-
Browser: all
-
Language: all
-
Loader/bundler: CLI
Feature: Allow configuration of prefixed module names, similar to the way JSPM handles different registries.
I would like to migrate my application from JSPM/SystemJS to the CLI. I am using prefixed module names, such as app:main
. The following is the relevant configuration:
SystemJS.config({
paths: {
"app:": "dist/app/",
"nav:": "dist/nav/",
"env:": "dist/env/",
"lib:": "dist/lib/"
},
packages: {
".": {},
},
packageConfigPaths: [
"lib:*/config.json",
],
});
What is the motivation / use case for changing the behavior?
I've split my application into multiple segments to better isolate different components and code with different code. E.g. modules in the env
segment handle managing the environment of my app (what servers to connect to, the logged in user, the user's credentials, etc); content for my app itself is in the app
segment.
Unprefixed module name reduce code clarity. Using prefixed module names, I immediately know if a given import refers to my code or a 3rd party dependency, and if it's the former, I also immediately have a general idea of the purpose of the imported code.