in other threads it has been noted that no files can be created by a build step (npm run myscript) or server-side code. the jsx transform middleware just compiles the jsx into js at the time of the request, correct? I was able to do something similar with browserify once I saw the file permissions were strict. Performance-wise this is not ideal. Do you think that the memory available would be enough to cache a compiled resource so that it can be served immediately? Has anyone tried? I’m not complaining by any means here, I’m just curious about a work-around that could yield decent page-load times if this were to become a production hosting solution for me.
this doesn’t help with page load performance. for a fast-loading website, I need a single, minified, gzipped js bundle.
it seems like this is the best option for now since it allows caching and would not hurt performance in production. babel and uglify could also be introduced via a transform: https://www.npmjs.com/package/browserify-middleware
I think browserify-middleware is a good choice. You should also be able to write to /tmp in your containers and can configure some modules to use that directory as a file cache.
I’m super unfamiliar with anything beyond static sites and playing with javascript in a sandbox. I’m using the facebook tutorial to get my feet wet with react and JSX and the readme says “Just add it to your package.json” what does that mean? I havent found any documentation anywhere about how to work with package.json.
How do I get it to render? Do I add all of the files from the starter pack to my HyperDev VM? Do I just type in some voodoo to package.json?
There’s some useful background about what a package.json file does on the npm site ( https://docs.npmjs.com/getting-started/using-a-package.json ), but it essentially allows you to specify what packages you want to use in your project, amongst other things.
In the case of the React JSX example, if you look at the package.json file you can see we’re including express and the express jsx transform packages in the dependencies section. So if you’re told to add it to your package.json, typically they just mean to add whatever package they’re referring to there. We make it easy to do that in HyperDev by embedding npm. So if you search for the package you want from the ‘Add package’ drop-down at the top of the editor window when viewing the package.json file, it’ll automatically add the required line to your package file.
We also have an implementation of the main React tutorial project that you might want to follow to understand some of the core concepts about how React works: https://hyperdev.com/#!/project/shade-king. If you remix it, then you can play around with it for yourself.