Comments (9)
And to support all the aliases:
jspm install --provider esm.sh react/jsx-runtime=preact react-dom/test-utils=preact react=preact/compat react-dom=preact/compat -r react=npm:preact -r react-dom=npm:preact
The react/jsx-runtime=preact
is probably also a bug - in that we should require explicit aliasing of the exact install, as opposed to inferring the path into the target.
from jspm-cli.
Try the following, and let me know how far you get with this:
jspm install --provider esm.sh react=preact/compat react-dom=preact/compat -r react=npm:preact -r react-dom=npm:preact
Resolutions only behave at the package level (more like npm resolutions), that react=preact/compat
was working is really a bug - it's important that these are always package to package mappings.
So we use both techniques because you want to both lock the dependencies and also alias the entry point.
from jspm-cli.
And here's an even simpler command:
jspm install --provider esm.sh react/jsx-runtime react-dom/test-utils react=react/compat react-dom=react/compat -r react=npm:preact -r react-dom=npm:preact
from jspm-cli.
I stumbled upon the resolution flag which seems to be the option to solve these alias problems
However, it does not work with submodules, which are needed for the correct aliases of preact. I guess this problem is similar to the problems with submodules using plain jspm install alias=package
described above.
$ jspm install --provider esm.sh -r react=preact/compat -r react-dom=preact/compat
Error: Unable to resolve npm:preact/compat@ to a valid version imported from file:///home/myhome/myproject/
Also note that the resolution documentation aliases react
to preact
, which is wrong according to preact alias documentation
from jspm-cli.
that
react=preact/compat
was working is really a bug - it's important that these are always package to package mappings.
This surprises me slightly. I was assuming that --resolution
could work similar to aliasing so that also subpackages could be remapped. But if the functionality is fully there also without this, I am super happy.
EDIT: Wait, I think I overlooked this. How is the package to package mapping resolving preact alias correctly? There it is a package to subpackage mapping, isn't it?
The
react/jsx-runtime=preact
is probably also a bug - in that we should require explicit aliasing of the exact install, as opposed to inferring the path into the target.
I agree. I am always expecting a plain mapping without any magic.
from jspm-cli.
I tested it now, and it fails as far as I can see
running
jspm install --provider esm.sh react/jsx-runtime=preact react-dom/test-utils=preact react=preact/compat react-dom=preact/compat -r react=npm:preact -r react-dom=npm:preact
results in
imports: {
"react-dom/compat": "https://esm.sh/*[email protected]/compat",
"react-dom/test-utils": "https://esm.sh/*[email protected]/test-utils",
"react/compat": "https://esm.sh/*[email protected]/compat",
"react/jsx-runtime": "https://esm.sh/*[email protected]/jsx-runtime",
},
"scopes": {
"https://esm.sh/": {
....
"react": "https://esm.sh/*[email protected]",
"react-dom": "https://esm.sh/*[email protected]",
...
},
}
which on both sides is wrong - react
(the package) needs to point to preact/compat
(the subpackage)
from jspm-cli.
Also I actually don't need it in the import section, as I am not importing react myself. It is really just needed within the scopes, for my case, as I want to use material-ui which by default uses react, but should use the same preact version
from jspm-cli.
@guybedford can you help? I am still unable to use jspm to create dependencies which respect my preact aliases
from jspm-cli.
@guybedford any progress for aliasing a package to another subpackage?
from jspm-cli.
Related Issues (20)
- conditional requirement with top-level await HOT 2
- Github packages and/or repositories HOT 5
- Relative path imports in react-dom (dev), react-intl, semantic-ui-react HOT 2
- Error "Trailing "/" installs not supported installing" when installing react-intl using esm.sh provider HOT 2
- Fix Windows Tests HOT 1
- Certificate issues on ga.jspm.io HOT 1
- Support succinct list of updatable deps, and excluding certain deps in an "update all"
- Development mode for esm.sh HOT 5
- How to achieve intellisense with libraries defined in import maps? HOT 4
- `tailwindcss` Has an `oxide` Error HOT 3
- Dev Watch Serve
- Build lock
- jspm build: Make rollup configuration optional HOT 4
- Windows CI HOT 1
- No './300.css' exports subpath defined in https://ga.jspm.io/npm:@fontsource/[email protected]/ HOT 3
- `jspm install twind` fails HOT 1
- Feature Request: Respect package.json alias section when resolving dependencies
- ERROR Module not found ABC HOT 1
- esm.sh failing on lit imports HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jspm-cli.