Comments (1)
This turned into a bit of a Webpack vs Rollup exercise.
Webpack won. 4% smaller bundle and less painful config.
For posterity...
Webpack
Webpack's documentation was as baffling as always, of course there's 600 ways of using externals
and I'm sure it's perfectly obvious which one to use if you already know which one to use.
Bundle size: 4.159 KB
Config:
const path = require('path');
const { peerDependencies } = require('./package.json');
module.exports = {
mode: 'production',
entry: path.resolve(__dirname, 'src/index.js'),
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'umd',
},
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader',
},
],
},
externals: Object.keys(peerDependencies),
};
Rollup
Rollup needs 4 plugins and the associated reading material just to work. I wound up copy/pasting from react-redux
. And it throws 'circular reference' warnings, which is not confidence inspiring.
Bundle size: 4.335 KB
Config:
import babelPlugin from 'rollup-plugin-babel';
import nodeResolvePlugin from 'rollup-plugin-node-resolve';
import commonJsPlugin from 'rollup-plugin-commonjs';
import { uglify } from 'rollup-plugin-uglify';
import { peerDependencies } from './package.json';
export default {
input: './src/index.js',
output: {
file: './dist/index.js',
format: 'umd',
name: 'ReactRecollect',
},
external: Object.keys(peerDependencies),
plugins: [
nodeResolvePlugin(),
babelPlugin({
exclude: '**/node_modules/**',
runtimeHelpers: true,
}),
commonJsPlugin(),
uglify({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false,
},
}),
],
};
Parcel
Was a non-starter, since it seems it can exclude externals (e.g. react).
from react-recollect.
Related Issues (20)
- Subsequent renders with pure children doesn't recollect data
- Passing store data to a collected component can have unexpected results HOT 1
- CodeMirror onChange event appears to have an outdated store HOT 7
- Collected components re-render when an unused property is created HOT 3
- Checking prop types of non-collected components counts as reads
- Create module/cjs builds in addition to umd
- Some reads in componentDidUpdate aren't getting the old store
- Add better debugging tools
- Top down rendering? HOT 3
- Don't process props in production HOT 1
- PropType Errors Collapsed HOT 1
- Add .back() and .forward() debug tools (time travel)
- How to deal with discriminated union types? HOT 2
- Can you please elaborate on how to convert `redux-saga` to use `react-recollect`? HOT 2
- __RR__.getStore is not a function HOT 1
- Expose a `useStore` hook. HOT 1
- Borrow local to feedback for `Scroll Memory` extension
- Is this project is still active? HOT 2
- Add a useProps function
- <React.Strict> causes "You are attempting to modify the store during a render cycle"
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-recollect.