babel-esm-plugin | generate mirrored esm modules for your existing bundles | Plugin library
kandi X-RAY | babel-esm-plugin Summary
kandi X-RAY | babel-esm-plugin Summary
Add this plugin to generate mirrored esm modules for your existing bundles
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of babel-esm-plugin
babel-esm-plugin Key Features
babel-esm-plugin Examples and Code Snippets
Community Discussions
Trending Discussions on babel-esm-plugin
QUESTION
because of some issues such as having SSR, SSG, and CSR beside each other, I decided to create my own SSR for React js with express js, I'm using redux and saga, and I have several API calls to generate the data before rendering it. so I had to use several promises in my server-side renderer, such as waiting for redux to finish all APIs, or waiting for styles and scripts, also I'm using react-ssr-prepass and it navigates through all my components (for dispatching actions that are required in SSR). so I have a lot of thread-blocking stuff in my project.
for handling concurrency I started to use node-cluster, so I'll have several nodes on my server and it will increase the concurrency capacity, but it's not the best solution because, under heavy load, even node clustering won't be able to respond to all of the requests.
so I started to think about worker thread or child process in node js, so I make an instance of my server-side renderer on each request and do everything in the background, so concurrent requests won't wait for eachother to be done.
but the issue is in the child process or worker thread I can't use "import", since it's es6
so I have two questions
first of all, is there any way to use es6 in the child process? (I tried babel-esm-plugin but it's not supporting webpack 5)
second, is there any better idea than using worker thread of child process to increase the concurrency capacity?
...ANSWER
Answered 2021-Nov-12 at 07:37so I found the solution for my first challenge, instead of running my renderer directly with the child process, I had to build it first, so I used webpack to make a cjs output of it, then use that output in the child process.
and for increase the performance, even more, I used a combination of SSR and SSG, so in each request I check if a file mapped to the route exists on the server, if it's not, I'm gonna use SSR renderer output to create a file, and serve the response to the user, then for next request since the cached file exists I use that cache file instead of rendering the result again. finally I set a corn job on the server to clear the cache every 10 minute
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install babel-esm-plugin
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page