New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

amd-script

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amd-script

Load anonymous AMD modules, reasonably

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

amd-script

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="amd-script.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.
  2. Provide an array of files for input.
  3. 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

License

MIT

Keywords

FAQs

Package last updated on 23 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc