Comments (6)
Faced similar error and running npm install --save-dev webpack
did solve the problem. Thanks!
from webpack-stream.
You are correct. Peer dependencies are an awful user experience. See #241 (comment)
from webpack-stream.
Peer dependencies may be a bit complexer, but also provide a lot of improvements when done correctly.
from webpack-stream.
My negative opinion on peer dependencies comes from being on the Grunt and webpack teams as well as maintaining and interacting with many frameworks and plugins but that was awhile ago, so maybe things have changed. If you got some examples of them being done correctly, I would love to see them and copy their work because I have no idea how to do them correctly.
I much prefer just declaring dependencies
that for sure will work with the library and then provide a dependency injection mechanism to override a peer dependency. Maybe the injected version doesn't work but it is explicit to the end developer as they are injecting it. The problem is exacerbated as you add more plugins with overlapping compatible framework versions hence the added resolutions
feature of package installers... but even that fails if not all the plugins are compatible with the resolved framework version. You're stuck waiting on all the maintainers of each plugin to update to progress up in versions.
from webpack-stream.
Hey shama,
with correct I meant more "at the right position, not for everything, just like needed", but that also changed a few times for me :D And while writing the rest of this comment, realized for me it is more a "is it a plugin for something or is it using that something standalone" question.
For "NodeJS/backend"
peer-deps aren't so important imho
- mostly no problem with installing the same stuff multiple times
- with especially the pros you already listed :)
- problems occur when: an installed package is using a package and that package is using some global configuration
- like webpack
- if installed two times, the configuration/internal state may not be in sync anymore
- when not installed by user, sometimes this leads to very strange issues when the user wants to intercept e.g. webpack in his own code again
For frontend stuff
- installing a dependency multiple times, in different versions, will increase the bundle size
- enforcing to have "bigger" dependencies as peer-dependencies makes a lot of sense to not have them duplicated, ever
- people think more (hopefully) if they see that they need to install 10 more packages
- e.g. my eslint will warn if importing packages that are not installed through my projects
package.json
- or the library, that is using those dependencies, need to reexport it
To be honest, don't have that much examples in my mind atm., maybe remembering some in the next days.
- @material-ui/core is a general peer-dependency of my @ui-schema/ds-material, thus allowing the user to install like neccessary, as imho people will more likely install @ui-schema to an existing @material-ui codebase and not otherway arround - but i'll include
immutable
in the future, so this won't be a peer-dependency anymore - @babel plugins in general, you install babel, then the plugins, not expecting that the plugins include babel
When using webpack-stream
, then webpack
should be provided by the user imho, as it may integrate into an existing codebase where webpack
already exists or should be used even without webpack-stream
. Like with babel, as webpack-stream is more a plugin for webpack, you don't expect a plugin to include the programm it integrates into.
Side note: the newer npm versions (since v7) warn/fail when installing the wrong peer-dependency, thus some of the DX has been optimized, but that means the published packages need to correctly tell their valid peer-dep versions.
from webpack-stream.
Thank you a lot! Your solution helped me. The solution is: npm install --save-dev webpack
from webpack-stream.
Related Issues (20)
- DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead HOT 5
- DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead HOT 1
- Support webpack version 5 HOT 2
- Webpack 5 HOT 3
- Using webpack 5 as described in README produces empty output files HOT 1
- Webpack 5 warns about a deprecation in watch mode HOT 4
- Error: Rule can only have one resource source when using webpack-stream HOT 4
- webpack.config entry import syntax support HOT 1
- Slowdown after upgrade to 6.x.x. HOT 4
- Using webpack-5 results in no output files HOT 4
- Question about multiple entry points
- DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_HASH HOT 2
- MODULE_NOT_FOUND error while using version 7.0.0 HOT 2
- [Error] Invalid left-hand side expression in prefix operation HOT 4
- Did you forget to signal async completion... HOT 5
- Remove the need to manually filter out source map files HOT 4
- Callback in being ignored in the multicompication case
- Webpack 5 Stream won't compile HOT 1
- Webpack stream w/ Gulp — errors when using aliases in webpack config HOT 1
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 webpack-stream.