Comments (8)
Currently, @dojo/shim
is a peer dependency of @dojo/core
(it must be installed as a sibling of @dojo/core
) and tslib
is a dependency of @dojo/shim
. I just spoke with @matt-gadd and @agubler and we should probably re-evaluate what should be a peerDependency
vs. a dependency
vs. devDependency
.
from core.
You can not assume that because tslib
is a dependency of @dojo/shim
that is installed next to @dojo/core
, that tslib
will also be accessible to @dojo/core
.
Technically tslib
must be a dependency of @dojo/core
(because it is). You can just let NPM figure out how it dedupes and optimalizes the final output tree.
For example it is perfectly fine to have this dependency tree (which i have):
node_modules
- @dojo
- core
- node_modules
-<currently tslib is missing here>
- shim
- node_modules
-tslib
Using regular NPM this will probably all be flattened as much as possible and it indeed will place tslib
in the root node_modules folder therefore being visible to @dojo/core
because of it searching up the tree.
Peer dependencies are mostly used for regular dependencies while letting the user determine which version is used.
from core.
Technically
tslib
must be a dependency of@dojo/core
It should be a peer dependency of @dojo/shim
, which then leads it to be a peer dependency of @dojo/core
.
Using regular NPM
Which version?
Peer dependencies are mostly used for regular dependencies but you want the user to choose which version he uses.
We actually don't want the user choosing which version he uses. We can assure that @dojo/*
works with the version of tslib
specified in the dependency of @dojo/shim
. As long as it's within the 1.8.x
series, the patch version doesn't matter. But @dojo/shim
will not work with [email protected]
. This is why tslib
should be a peer dependency: so every @dojo/*
package (and the user's code) will use the same tslib
and then the user can't mess that up.
from core.
I thought you were talking about @dojo/core
being a peer dependency of @dojo/shim
. Peer dependencies also have constraints just as regular dependencies do.
It should be a peer dependency of @dojo/shim, which then leads it to be a peer dependency of @dojo/core.
You can not make assumptions like this just because you do not know where "a package manager" places them.
Consider this scenario: I am developing a package that depends on [email protected]
(one that does not work with @dojo/shim
).
If i use NPM to install to install the following dependencies:
npm i [email protected] @dojo/core @dojo/has @dojo/shim
"dependencies": {
"@dojo/core": "^0.2.1",
"@dojo/has": "^0.1.1",
"@dojo/shim": "^0.2.3",
"tslib": "^1.6.1"
}
Them npm installs it as follows:
+-- @dojo/[email protected]
+-- @dojo/[email protected]
+-- @dojo/[email protected]
| +-- [email protected]
| +-- [email protected]
| `-- [email protected]
`-- [email protected]
@dojo/core
will use [email protected]
from core.
Why is this labeled question
. This is definitely a bug!
Let me try to make it easier to understand. Please create a new directory and run the following:
$ npm i @dojo/core @dojo/has @dojo/shim --no-package-lock --global-style
$ node -e "require('@dojo/core/async/Task')"
Error: Cannot find module 'tslib'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at \node_modules\@dojo\core\async\Task.js:12:19
at Object.defineProperty.value (\node_modules\@dojo\core\async\Task.js:3:17)
at Object.<anonymous> (\node_modules\@dojo\core\async\Task.js:9:3)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
The source code of @dojo/core
contain require('tslib')
statements so how could tslib
not be a dependency of @dojo/core
?
from core.
Do i need to make a pull request for this?
from core.
@mgroenhoff Hi, sorry for the delay getting back to you! We'd be very happy to take a pull request to make tslib
a dependency of dojo/core
from core.
For reference: dojo/meta#226
from core.
Related Issues (20)
- Update tests to Intern 4
- Deprecate (maybe remove) load
- Deprecate lang/assign (and refactor usage)
- old dojox.storage documentation is broken HOT 2
- `utils#throttle()` test fails in Edge HOT 1
- Xhr unit tests intermittently fail on IE11
- I just would like to use dojo2 as a library, it looks a little complex, how could I use it like a react or dojo1? HOT 9
- Evented is bloated
- Problem since TypeScript 2.7.1 – Type 'M[keyof M]' does not satisfy the constraint 'EventObject<keyof M>' HOT 9
- UrlSearchParams toString() should not add queryParams if they have no value set
- has.ts causes loading the main bundle to crash in Internet Explorer 11 in https HOT 4
- Support the abortable fetch API HOT 1
- dojo/widget-core typo in code snippet HOT 1
- README: outdated Promise doc
- Docs for UrlSearchParam are wrong
- Upload progress events add preflight request
- Standardize Constructor exports
- Evented listener destroying its own handle won't run all listeners
- lang.mixin errors with null target
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 core.