Comments (28)
Trying it out - need to do a few tests.
from little-state-machine.
I know - just wanted to try running it locally to see the new tree view, and build my app to see if it included the new library (react-json-tree
).
It now includes the new library, although it is smaller in size.
from little-state-machine.
from little-state-machine.
I think i know the fix now, i will sort out in the next couple days.
from little-state-machine.
hey @ururk what's the bundle tool that you are using? definitely not intentional.
from little-state-machine.
create-react-app - not ejected
from little-state-machine.
may i know which version?
from little-state-machine.
3.4.1
from little-state-machine.
I'm not sure it's create-react app's fault - in the dist folder for little-state-machine, index.js, line 425-429:
const clone = require('lodash.clonedeep');
let ReactJson = (props) => React.createElement("div", Object.assign({}, props));
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
ReactJson = require('react-json-view').default;
}
I'm not as well-versed on the build/bundling side of things, but it looks to me like require will always be called when run in-browser.
There's no conditional outside of these lines.
from little-state-machine.
looks like that's a bug at little state machine.
from little-state-machine.
Yep - sorry if I wasn't clear enough!
from little-state-machine.
nah all good, i think the reason little state machine did that because of SSR: mac-s-g/react-json-view#121
from little-state-machine.
i may have to switch to another lib...
from little-state-machine.
can you try this version: 3.0.0-beta.1
from little-state-machine.
core codebase is not changed @ururk only that dev tool with json view.
from little-state-machine.
sounds good to me :) so it's still in the prod build? 🤔
from little-state-machine.
Yes - still in prod build. I even tried removing "import DevTool" and {process.env.NODE_ENV !== 'production' && <DevTool />}
.
from little-state-machine.
can i see a snapshot of the build result?
from little-state-machine.
looks like this one is CRA related? facebook/create-react-app#2748
from little-state-machine.
Here is the index.ts
file
import {
setStorageType,
createStore,
StateMachineProvider,
useStateMachine,
} from './stateMachine';
import { DevTool } from './components/DevTool';
import StateMachineContext from './StateMachineContext';
export {
setStorageType,
createStore,
StateMachineProvider,
useStateMachine,
StateMachineContext,
DevTool,
};
from little-state-machine.
Checking something...
from little-state-machine.
Thanks for helping @ururk
i have sent a StackOverflow question around this as well: https://stackoverflow.com/questions/61471907/export-module-with-node-env-with-ts
from little-state-machine.
Thanks! FYI - it is using index.es.js
- not index.js
from the dist folder.
I did a quick test and commented out the createElement
calls in DevToolStateTree
and it still included react-json-tree
, so this feels like a webpack/CRA bug like you suspected.
from little-state-machine.
Yea, and it's difficult with TS as well, it probably doesn't support dynamic export. I will publish v3 anyhow later tonight, it's better than what we got right.
from little-state-machine.
Yep! With the new library, I noticed you cannot scroll the tree when it is expanded past the browser window, can't recall now what the old behavior was, and if it is my app or not :P
from little-state-machine.
@ururk i will fix that :) (before the release)
from little-state-machine.
I'm also seeing react-hook-form in my parcel 2 builds. Am I right in understanding that this is fixed on the master branch? Also little-state-machine is showing as 16.01KB?
$ NODE_ENV=production parcel build src/index.html --experimental-scope-hoisting --detailed-report 20
✨ Built in 6.62s.
dist/src.eb090cc8.js 545.78 KB 6.54s
├── node_modules/react-json-view/dist/main.js 147.96 KB 11ms
├── node_modules/react-hook-form/dist/react-hook-form.es.js 33.8 KB 71ms
├── node_modules/jss/dist/jss.esm.js 25.36 KB 23ms
├── node_modules/little-state-machine/dist/index.es.js 16.01 KB 5ms
from little-state-machine.
i will have to move dev tool out from the main repo.
from little-state-machine.
Related Issues (20)
- When Cookies are disabled, actions.updateAction({ name: 'bill' })} throws an error- TypeError: o.storageType.setItem is not a function. The website handles Cookie Disabled error gracefully by throwing a message, but this breaks the App. How can we avoid that? HOT 1
- Does `useStateMachine` trigger re-renders when an update occurs in another component tree? HOT 5
- unable to create mock provider for Jest+React testing Lib HOT 6
- unable to clear store HOT 3
- Help with the LocalStorage and Next.JS HOT 1
- Bf a /:/66 HOT 1
- npm ERR! code ERESOLVE HOT 1
- How to push data to an array state machine HOT 2
- Code Sample in TS is not working correctly HOT 4
- Reset store to initial value ? HOT 1
- Catching Storage error HOT 1
- Error when using with next.js HOT 1
- state not up to date HOT 3
- how to get the global state value outside of the component. HOT 1
- Setting up testing patterns for LSM (React Testing Lib + Jest) - LSM returns empty object in JSDOM HOT 1
- Access the CreateStore Outside a React Component HOT 1
- Dynamically set store name with data from backend HOT 1
- Changing schema of state - guidance on versioning/migrations?
- Type Error for actions without a payload.
- List of Contributors to be present in the Readme 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 little-state-machine.