I'm really dissatisfied with the current approach of simply dumping all JS files in index.html via src tags. It makes the code hard to organize and unmodularized, creates potential for namespace conflicts and dependency order issues, and makes it impossible to take advantage of autocomplete and linting tools in code editors. It was really inconvenient when I was trying to write the interactive experiment.
As discussed in an email before, the problem is that there is this annoying
Error: Access to Script at 'file:///***/es6/code.js' from origin 'null' has been blocked by CORS policy: Invalid response. Origin 'null' is therefore not allowed access.
error for many browsers.
However, if using npm is already the recommended way to run an experiment anyways, then running a local node webpage server is trivial with one more npm command. Of course we may still need to take care of users who don't want to install npm and just want to view the experiment without necessarily editing it or understanding any JS. However, they should in most cases be able to find the experiment published online anyways.
The current approach still works but can be error-prone in the future when the complexity of the project keeps increasing. This is an issue at least to keep in mind IMO.
Or maybe we can at least keep an eye on whether Chrome and Safari are going to make it easier to load modules locally.
I'm really dissatisfied with the current approach of simply dumping all JS files in
index.html
viasrc
tags. It makes the code hard to organize and unmodularized, creates potential for namespace conflicts and dependency order issues, and makes it impossible to take advantage of autocomplete and linting tools in code editors. It was really inconvenient when I was trying to write the interactive experiment.As discussed in an email before, the problem is that there is this annoying
error for many browsers.
However, if using
npm
is already the recommended way to run an experiment anyways, then running a local node webpage server is trivial with one morenpm
command. Of course we may still need to take care of users who don't want to install npm and just want to view the experiment without necessarily editing it or understanding any JS. However, they should in most cases be able to find the experiment published online anyways.The current approach still works but can be error-prone in the future when the complexity of the project keeps increasing. This is an issue at least to keep in mind IMO.
Or maybe we can at least keep an eye on whether Chrome and Safari are going to make it easier to load modules locally.