# anonmd

> Load anonymous AMD modules, reasonably

Latest version **1.0.0** (published 2018-07-23) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install anonmd
pnpm add anonmd
yarn add anonmd
bun add anonmd
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-07-23 |
| First published | 2018-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Pat Cavit |
| Maintainers | tivac |
| Keywords | amd, script, loader |

## Links

- npm: https://www.npmjs.com/package/anonmd
- Repository: https://github.com/tivac/anonmd
- Homepage: https://github.com/tivac/anonmd#readme
- Issues: https://github.com/tivac/anonmd/issues
- npm.io page: https://npm.io/package/anonmd

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-07-23

## README

# anonmd

Simple AMD `require` and `define` implementation designed to load from `<script>` tags that already exist on the page.

## Why?

Rollup's [`experimentalCodeSplitting`](https://rollupjs.org/guide/en#experimentalcodesplitting-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

```html
<script src="anonmd.js"></script>
<script src="./common.js"></script>
<script src="./app.js"></script>
<script>
    require("./app.js");
</script>
```

## Usage w/ rollup

1. Set `experimentalCodeSplitting` to true.
1. Provide an array of files for `input`.
1. Set `output.format` to `"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

- [almond](https://github.com/requirejs/almond)
- [hazelnut](https://github.com/developit/hazelnut)
- [AMD Spec](https://github.com/amdjs/amdjs-api/)

## License

MIT

---
_Source: https://npm.io/package/anonmd · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
