I’m wondering if it will not be even better to not fetch the dependencies by just use CDN service like https://www.jsdelivr.com/
This way we ensure that every users has always the last version of the dependencies and we can ensure to fetch the proper version.
For those who does not want to use a CDN, they could still fetch the dependencies locally and change the path in index.html
.
Indeed I’m wondering if it will not be simpler to just use the import
statement and convert all JavaScript files into module. The support of this feature is quiet largely supported: https://caniuse.com/mdn-javascript_statements_import.
This way there will be no need to compile or bundle the source. This will simplify the development and remove the nodejs dependency. But there will still be the 4 spaces indentation issue.
Also the browser will have to fetch more files but I think this could be solved by using HTTP2 and Link header to make preload with maybe push.
A second point is that javascript will no more be minified. This is a good and bad point. The good point is that it is simpler to debug even on production. The bad is the size downloaded but this may be highly tempered by using compression (like gzip or brotli) on the server side.