Coder Social home page Coder Social logo

Comments (28)

ururk avatar ururk commented on July 26, 2024 1

Trying it out - need to do a few tests.

from little-state-machine.

ururk avatar ururk commented on July 26, 2024 1

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.

ururk avatar ururk commented on July 26, 2024 1

image

from little-state-machine.

bluebill1049 avatar bluebill1049 commented on July 26, 2024 1

I think i know the fix now, i will sort out in the next couple days.

from little-state-machine.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

hey @ururk what's the bundle tool that you are using? definitely not intentional.

from little-state-machine.

ururk avatar ururk commented on July 26, 2024

create-react-app - not ejected

from little-state-machine.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

may i know which version?

from little-state-machine.

ururk avatar ururk commented on July 26, 2024

3.4.1

from little-state-machine.

ururk avatar ururk commented on July 26, 2024

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.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

looks like that's a bug at little state machine.

from little-state-machine.

ururk avatar ururk commented on July 26, 2024

Yep - sorry if I wasn't clear enough!

from little-state-machine.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

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.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

i may have to switch to another lib...

from little-state-machine.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

can you try this version: 3.0.0-beta.1

from little-state-machine.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

core codebase is not changed @ururk only that dev tool with json view.

from little-state-machine.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

sounds good to me :) so it's still in the prod build? 🤔

from little-state-machine.

ururk avatar ururk commented on July 26, 2024

Yes - still in prod build. I even tried removing "import DevTool" and {process.env.NODE_ENV !== 'production' && <DevTool />}.

from little-state-machine.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

can i see a snapshot of the build result?

from little-state-machine.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

looks like this one is CRA related? facebook/create-react-app#2748

from little-state-machine.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

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.

ururk avatar ururk commented on July 26, 2024

Checking something...

from little-state-machine.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

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.

ururk avatar ururk commented on July 26, 2024

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.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

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.

ururk avatar ururk commented on July 26, 2024

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.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

@ururk i will fix that :) (before the release)

from little-state-machine.

D1plo1d avatar D1plo1d commented on July 26, 2024

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.

bluebill1049 avatar bluebill1049 commented on July 26, 2024

i will have to move dev tool out from the main repo.

from little-state-machine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.