Comments (9)
I can only confirm that generally speaking flat bundling (what rollup does) is better than having a directory structure - it allows for easier tree-shakeability webpack (upcoming webpack@4 might get better at this, but anyway many, many users still use webpack 2 or 3).
There is no reason to allow for package/submodule
imports (also setting this up in proper way is quite difficult and there is no tool - that im aware of - at the moment which does it automatically). I see a room for package/flavour
though (i.e. unistore/react
, unistore/preact
), but this library is a set of utilities and as such IMHO it should be accessible from a single entry point.
Having a proper tree-shaking tooling will make proposed import Hover from 'react-powerplug/Hover'
and import { Hover } from 'react-powerplug
equivalent - exact same code should land in your final bundle.
from react-powerplug.
Thanks again 😄
For now it's possible to import this way
import Hover from 'react-powerplug/lib/components/Hover'
To make import of react-powerplug/Hover
possible, we will need to change the folder structure, OR add some config to rollup that I don't know, but we can search about.
from react-powerplug.
Oh awesome! That's wonderful 👏 I'll look into it and see if we can make them a litter easier to write, but this works great for now. Thanks for the quick reply!
from react-powerplug.
You're welcome!
I will leave this issue open, so anyone can help too.
from react-powerplug.
I would not rely on folder structure. It's bad pattern and tree shaking improvements in the last months can prevent us from it.
from react-powerplug.
You are right @TrySound.
Do you have some suggestions?
from react-powerplug.
I tried both rollup and webpack and they both treeshake good. The only side effect now is State
component, but it's base component, it always will be if library is used.
from react-powerplug.
State
treeshaking will be available after babel/babel#6963 merge
from react-powerplug.
Thanks for your explanation @Andarist!
I'll close this issue since v1 will not have a export default (#31), which will help with tree shaking.
from react-powerplug.
Related Issues (20)
- [Feature Request] <Tabs /> component for Tabs or Carousel. HOT 2
- Toggle documentation outdated HOT 1
- Warning: The prop `children` is marked as required HOT 1
- Currently is a pain to edit flow files in a project HOT 4
- Why are there no control props for the state management components? HOT 3
- Export flow type definitions HOT 6
- Upgrade typescript definition HOT 11
- react-powerplug breaking build after babel 7 upgrade HOT 16
- onMount={props => ...} HOT 2
- Bad English in README HOT 2
- State component - "onChange" question HOT 1
- RFC: ElementContainer HOT 3
- Latest should not point to a release candidate HOT 5
- `State` component implements `Value` component & not the other way around HOT 3
- Wrong types with Flow and react-composer and compose HOT 1
- [Feature Request] React hooks support. HOT 4
- Add access to browser events to feedback containers
- Changing state causes rerender that breaks animations
- Initial Hover state is wrong on load if cursor is over element
- Document site is broken, 404 Not Found 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 react-powerplug.