docs.sheetjs.com/docz/docs/02-installation/06-amd.md
2022-06-11 13:21:26 -04:00

1.2 KiB

sidebar_position sidebar_custom_props
6
summary
NetSuite, RequireJS and other module systems

import current from '/version.js';

AMD

Each standalone release script is available at https://cdn.sheetjs.com/.

xlsx.full.min.js supports AMD with name xlsx out of the box.

https://cdn.sheetjs.com/xlsx-{current}/package/dist/xlsx.full.min.js is the URL for {current}

NetSuite

After downloading the script, it can be referenced directly in define calls in SuiteScripts:

define(['N/file', './xlsx.full.min'], function(file, XLSX) {
  // ... use XLSX here
})

As explained in the NetSuite demo, module aliases are created in config files referenced via @NAmdConfig comments.

RequireJS

After downloading the script, it can be referenced directly in require calls:

require(['./xlsx.full.min'], function(XLSX) {
  // ... use XLSX here
});

The requirejs.config function can define aliases through the paths key:

requirejs.config({
  paths: {
    xlsx: [ './xlsx.full.min' ]
  }
});