rollup-plugin-peer-deps-external | Automatically externalize peerDependencies | Plugin library
kandi X-RAY | rollup-plugin-peer-deps-external Summary
kandi X-RAY | rollup-plugin-peer-deps-external Summary
Automatically externalize peerDependencies in a rollup bundle.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of rollup-plugin-peer-deps-external
rollup-plugin-peer-deps-external Key Features
rollup-plugin-peer-deps-external Examples and Code Snippets
Community Discussions
Trending Discussions on rollup-plugin-peer-deps-external
QUESTION
So i'm building a design system for this company and the component system is displayed correctly in the design system storybook. But when I import it in the consumer app I get the following error
...ANSWER
Answered 2021-May-04 at 13:57I've had a similar issue when developing a component library using storybook and emotion/styled-components. The issue was that I was using the styled-components' ThemeProvider from the consumer app, as you did in your _app.js
. The solution was to create and export a custom ThemeProvider on the component library, using the library's styled-component package, like so:
QUESTION
I need to configure rollup-plugin-postcss to only modify the CSS class names of certain files. I know this is possible with WebPack but I can't figure out how to do it with Rollup. Ideally I would like to give a regular expression that describes what to do with CSS files that match that criteria.
This is what my rollup.config.js looks like:
...ANSWER
Answered 2021-Apr-16 at 21:43I kind of figured it out. I used rollup-plugin-postcss-modules instead of rollup-plugin-postcss. This is what my rollup.config.js ended up looking like:
QUESTION
It's my first time creating a typescript react npm module, and I am trying to import one of the type definitions in my project that is using the new npm module. VSCode intellisense is able to find and suggest the one of the automatically generated .d.ts
files, but the application fails to load it. What is going on?
ANSWER
Answered 2021-Apr-03 at 21:29I'm a bit surprised you're loading types from the types.d file direct and with a build path! I'd expect rather import { Type } from '@myorg/component-library
.
That's because as part of creating the package.json for a typescript-authored npm library you'd be defining a main property pointing to the place that exports all the Javascript properties and a types property pointing to the place that exports the typescript types you want.
If that main entry point (because of your build process) is actually build/index.js
and the corresponding types file is build/index.d.ts
then you'd never directly reference the build folder or files when importing - pointing to the right path is dealt with by the bundling process.
Take a look at a mainstream (but simple) typescript npm module like https://github.com/jamiebuilds/unstated-next/blob/master/package.json ( https://www.npmjs.com/package/unstated-next )
You can see the main property pointing to the file which should export the javascript names https://github.com/jamiebuilds/unstated-next/blob/master/package.json#L6 and the types property pointing to the file which should export the types https://github.com/jamiebuilds/unstated-next/blob/master/package.json#L9 and these happen to be in the 'dist' folder but this is never referenced when importing it as per the docs at https://www.npmjs.com/package/unstated-next
QUESTION
I am exploring making a component library using React and rollup, but finding that the app that is consuming the library is bundling it in the wrong order.
This is causing the below error:
...ANSWER
Answered 2021-Feb-01 at 01:07So my setup actually was working. There was somehow a glitch in the symlink. I as able to resolve by running yarn unlink
and yarn link
. The package is now bundling correctly.
QUESTION
I'm currently building a UI library to simplify maintenance across multiple applications. These currently use Ant Design.
All seemed to go fine... I added my peer dependencies in both package.json
and rollup.config.js
(via externals) and I was able to get Rollup to produce an es and cjs binary which successfully exports just my code.
However, when I import either of these into my host application (Electron and/or React, already using antd without issue) I am receiving the following error:
...ANSWER
Answered 2020-Dec-11 at 22:16If this issue happens while you're linking the local version of your library in your main project to speed up the development. It might be related to "duplicate version of React".
https://reactjs.org/warnings/invalid-hook-call-warning.html
This problem can also come up when you use npm link or an equivalent. In that case, your bundler might “see” two Reacts — one in application folder and one in your library folder. Assuming myapp and mylib are sibling folders, one possible fix is to run npm link ../myapp/node_modules/react from mylib. This should make the library use the application’s React copy.
In short:
- run
npm link
in /your-app/node_modules/react. This should make the React's global link. - run
npm link react
in /your-ui-library. This should make the library use the application’s React copy.
QUESTION
I'm creating an internal NPM package that contains the base layout for all of our ReactJS web applications. In this package, I am using styled-components for formatting the components, and rollup to build the package. Styled components is also used in the target application.
Here are the config files:
packages.json
...ANSWER
Answered 2020-Dec-09 at 00:17So, after two weeks, it turns out that having an image in the theme was what was causing this. Changing the image from an import to a url reference fixed this problem.
QUESTION
I have created a React Library with rollup
, however, I have a large number of components that get exported so the file size is relatively large.
So in a project where I import the library doing the following;
...ANSWER
Answered 2020-Jun-14 at 18:16You don't really need to do that if you use named exports and any modern bundler for building the app. When Rollup detects you are not using some export it will be removed due to tree-shaking.
If you still want to do it pass an object with the different entries you want to the input
option:
QUESTION
I am trying to use rollup to build a mini react component library of sorts, as soon as I add a react-konva component the errors appears, when I add the konva to the example I using to test the library it works fine leading me to assume its something with the way rollup handles konva. The only thing that I have seen on the github for react-konva that may link to this is: https://github.com/konvajs/react-konva/issues/504
- My Rollup Config
ANSWER
Answered 2020-Oct-25 at 04:02Well I look stupid, I randomly decided to change from duckduckgo to google to look up the issue and got a few github links for it one being https://github.com/konvajs/react-konva/issues/189 which made me think to remove my react konva and konva and reinstall it to the latest version and it worked my react-konva was on 16.13 or something and when I upgraded ended up on 17.0.0 which worked
QUESTION
I am putting together a started kit to bundle a React
component library with Rollup
.
The library includes Antd
which uses LESS
, and Tailwind
.
I have an issue in my rollup.config.ts
file:
ANSWER
Answered 2020-Oct-01 at 09:22You have to use the postcss plugin before the commonjs one, or it will try to interpret the contents of CSS files as JavaScript. Maybe it also needs to come before the resolve one but not sure about that.
After making those changes you probably won't need to do anything for .less files since rollup-plugin-postcss already handles them.
Edit: after looking at the repository, you didn't need to use the postcss plugin before the other ones, just omit the postcss extensions option or set it correctly (was missing a dot in front of css):
QUESTION
I want to create a new npm package where i can export all @material-ui/core components but themed my way. Currently using typescript and rollup, but failing. This is my code
index.ts
...ANSWER
Answered 2020-Jul-25 at 03:41after investigating a lil bit more, i found out that is not your bundlers error (nor webpack, parcel or rollup). To fix this issue, you just have to publish your build into npm and install it from there (not locally) and voila, it works. cheers
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rollup-plugin-peer-deps-external
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page