Clarify third party plugins distribution model and usage of builder / `yarn plugin import`
See original GitHub issuePlugins are one of the best features introduced to berry. It remains however a bit unclear in the current documentation and in the current behavior of yarnpkg-builder how this feature fits into the larger ecosystem (i.e. outside the internal use of plugins by berry itself).
builder build plugin
always normalizes the plugin name to ‘@yarnpkg/xxxxx’. It’s not clear today if this is intended or if there is something more that we need to know,- the tutorial for plugin development does not use the
yarn plugin
command line, which behaves slightly differently from the tutorial example. Here again we may need a bit more clarity on the best practice of how plugins get added to a berry project, yarn plugin import
has different treatment depending on whether the plugin is hosted on yarnpkg repo or not. If not, it has to be a downloadable single file bundle. Why we can’t just ship third-party plugins as npm modules, add them as dev deps, and then yarn can just import from there, like usual?- even when a plugin is imported from the local filesystem,
yarn plugin import
builds a different cjs file. Not clear how is that working with builder and if we (as plugin developers) need to know about it.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
yarn plugin import
Details. This command downloads the specified plugin from its remote location and updates the configuration to reference it in further CLI invocations.
Read more >Could not find a declaration file for module 'module-name ...
import { SomeModuleType } from '3rd-party-module';. After removing the error went away... Clarification: When we declare a module in a *.d.ts file ...
Read more >Create a guided tour plugin in the admin panel - Strapi
Using yarn yarn create strapi-app my-project --quickstart # Using npx npx ... import 'sanitize.css/sanitize.css'; // Third party css library ...
Read more >Nixpkgs 22.11 manual - NixOS
The collection is distributed for users of Nix on non-NixOS distributions through ... plugins can use passed-through dependency to ensure that their plugin...
Read more >Production | webpack
In order to merge these configurations together, we'll use a utility called webpack-merge . With the "common" configuration in place, we won't have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Note that plugins are meant to be checked-in (same as the Yarn binary itself), so cloning is all that’s required to have a working environment.
Yes and no - plugins can’t access third-party packages out of the box because it would mean that they wouldn’t be able to execute until after the project has been installed (and thus after the plugins have already been executed).
That being said, you can bundle your plugin sources into a single binary (like we do for Yarn), in which case you can use whatever third-party you want since they’ll be stored inside the plugin anyway. This is what
@yarnpkg/builder
does for you, although it’s not well enough documented at the moment.