Two bundles with #nrwl/esbuild:esbuild - node.js

I seem to be unable to configure two entry points for my #nrwl/esbuild:esbuild target. I need to create two bundles. Is this possible?
I need to output two .cjs files, since I am using threads in nodejs and it seems that node isn’t happy for the main and worker thread modules to be in the same file.
The documentation is sketchy 😇 and I can't get the options on the ESBuild site to work in the project.json

Related

Vite Split Application And Configuration Bundles

Please help
What is the best way in a Vite based Application to split the application codebase and it's configuration (the Application not the Vite) so that both could be independently
built
delivered
I can see two options myself still stuck with the implementation
Chunks splitting
I've tried extract path/to/appConfig.ts to a separate chunk
This worked but with two cons
I cant figure out how to run an individual build command for a specific chunk (eg just for a config only) without spend time for the rest ones
Whenever the appConfig.ts content changes the chunk hashes changes for all the existing chunks regardless correspondent content were kept stable
Lib splitting
I have just an idea to setup two different vite projects for App it self and for a Config as a library. Still I can't understand.
Should this be resolved with two individual vite.configs for that purpose?
This would be good for individual build but how would both the bundles be integrated in the same index.html that case?
So what the direction is the better one to evolve? Or maybe is there any more appropriate solution for this?
Thanks

How can I easily enable/disable all modules in IIS?

In this serverfault answer, the author make the following comment:
As a test I pulled out every module in IIS so that it didn't even have a static page handler, and it still displayed the 400 error message.
I would like to do the same thing: disable all modules in IIS to perform a test, then re-enable all modules after my test. I can remove each module one-by-one, but that is tedious, and then I need to manually add them all back.
Is there an easy way to disable/enable all modules in IIS?
Lex pointed me in the right direction in the comments: the applicationHost.config file.
According to the documentation, this file is located at %windir%\system32\inetsrv\config.
That file appears to have two lists of modules: globalModules and modules. I was able to quickly enable/disable modules by simply commenting/uncommenting modules in the modules list.

How to merge 2 applications using their own Gruntfile.js and their having their own package.json

I have two differents apps using a gruntfile.js and a package.json and when i launch locally my second app (providing only 1 functionnality, thats why i trying to merge it with the other), this works, but when i try to works the functionnality by merging the second app in the principal app, it says that modules are missing.
My principal app is the BPMN editor from: https://github.com/bpmn-io/bpmn-js
And the second app is the BPMN-diffing from: https://github.com/bpmn-io/bpmn-js-diffing
My BPMN_editor's Gruntfile is minifying BPMN_editor's .js files, then i tried to do the same for BPMN diffing's js files. but nothing is working, my node server wont run normally (while hes working without this BPMN diffing).
I dont understand how to use the bpmn diffing, should i make an npm install to install all dependencies of bpmn diffing, and then make an npm install of the bpmn editor to install dependencies ? or should i merge the Gruntfiles and the package.json files ?
Thanks a lot
Fantemis
If they are based upon two differrent configurations, I would prefer using a load balancer or a reverse proxy to load them on the server. Merging the projects takes a little more insights from you and a little effort. The effort always depends on the setup. I would give you a little tip, but I am not seeing a Gruntfile in your main principle repository.
A little insight into "Reverse Proxy vs. Load Balancer"
What is the difference between Reverse Proxy and Load Balancers
Alternative 1 (preferred):
You could however create a small node.js server, which is handling the serving of those two applications, like the following:
- bpmn_root
|- principal
|- diffing
Afterwards you just need to write a little script, that is building both things on the server you want it to be deployed, and then you just need to do node SCRIPT_NAME.js.
Further reading, and another post about this.
Alternative 2:
You can use Docker. I am not very aware of how to use Docker to power such thing, but it is "as simple as" creating an Nginx configuration, which is doing the reverse proxy stuff for you.
Alternative 3:
Using the load balancer, which is handling the reverse proxy automatically. This is also a little more complex and needs some more learning to do. You can find plenty of tutorials on this however on the internet.

Running multiple node applications using same configuration file that is outside of each project

I am using pm2 to run several node applications. Problem is that I am using config files for every node application and so what I want to do is easily have say a json file outside of all the node application folders in which they can ALL point all for common database connections etc...
Prefer to not use linux environment variables unless there is an easy and great way of setting it up
pm2 does have the ecosystem, but it doesn't seem to be very well documented to me
what other solutions?
pm2 ecosystem // this generates .config.js not a .json
Create json or yml file. Put it in your root projects folder. And write "configProvider" which will read the file and populate configuration. It works really well for us. Especially this file can also been shared between different languages, not only javascript.

How to create a sails.js skeleton so I can quickly build new apps with common goals?

This is more for some fun and playing around with, but hopefully should produce something useful.
I would like to extend sails.js framework so that when I generate a new app using 'sails new project-name' it will already have a lot of previous configurations or modules added. For example, with every project I would probably intend to use SASS. If you have had to setup SASS with sails before you will know it has a few bits of configuration to do first. It would be advantageous to not have to repeat this with each new project.
In short some things I would like to achieve upon creating each new project:
Get SASS configured
Generate multiple SASS partial files, such as _buttons.scss, _forms.scss
Include SASS mixings within certain SASS files
Include configuration and set up to use multiple databases like mongoDB and MariaDB (Much more complex I imagine)
Thanks
At Balderdash we do this all the time to quickly spin up certain "types" of application.
You can fork https://github.com/balderdashy/sails-generate-new and customize it to call additional generators that you can create using ejs templates.
I created a module called sails-generate-entities which you can see in use here: https://github.com/tjwebb/sails-permissions/blob/master/index.js. For this sails extension, you'd call sails generate permissions-api and all those files would be added to the project. Your fork of sails-generate-new could include a call to a custom generator such as this.

Resources