1.0.0 • Published 7 years ago
anonmd v1.0.0
anonmd
Simple AMD require and define implementation designed to load from <script> tags that already exist on the page.
Why?
Rollup's experimentalCodeSplitting option supports chunking and AMD output, but outputs anonymous modules using filenames for dependencies. I couldn't find an AMD loader that handled that for the case where all the files are manually included in the right order using <script> tags, so here we are.
Example
<script src="anonmd.js"></script>
<script src="./common.js"></script>
<script src="./app.js"></script>
<script>
require("./app.js");
</script>Usage w/ rollup
- Set
experimentalCodeSplittingto true. - Provide an array of files for
input. - Set
output.formatto"amd"and let 'er rip.
For ease of writing your HTML & <script> includes you'll probably also want to set output.chunkFileNames to something like "[name].js" so they don't include a hash and keep changing.
Prior Art
License
MIT
1.0.0
7 years ago