es4x
es4x copied to clipboard
can es4x not rely on node_modules?
sorry, my english is not good.
i want to try to package js files with webpack, just like fat jar in java. in this way, we can not rely on node_ modules。
but es4x will use es4x-launcher.jar in node_modules。
maybe it can be started via
es4x -file dist/index.js
like
java -jar xxx.jar
without node_ modules
Hi @fantasy0v0, the dependency on node_modules
happens on the install
command. This isn't really required to be node_modules
at the time I decided to use it because i found it easy to do npm install
and es4x install
and if I wanted to clean my project, I'd just delete the node_modules
.
I am observing that users are asking more and more to avoid the npm
dependency. For this I've already added some basic support to download modules, so in ES6 you can just import from the web like deno
does (It still has an issue with jvm dependencies, which can't be computed this way).
I think a quick win would be to have the "hard coded" node_modules
directory target for the install command to become a variable, for example:
es4x install -d dist
which would set the default from node_modules
to dist
, so in this case you would get inside the dist:
dist/.bin/es4x-launcher.jar
dist/.libs/<all required jars>.jar
This would also need that the startup scripts would be generated pointing to the right place.
Do you think this would work for you?
The remaining issue is that the @es4x/create
module (where the es4x
command lives) would need to be aware of this change too. Perhaps if node_modules
exists then look there first, otherwise, fallback to the CWD
but I don't know if this is trivial. I'm just writing out of my head.
may also need to modify the Main-Verticle in MANIFEST.MF. because there may not be a dist directory on the server.