sheetjs_sheetjs/demos/fusebox
SheetJS 5de62a947f version bump 0.12.5: ancillary utility update
- add BOM to `stream.to_csv` (fixes #1024 h/t @hr5959)
- `utils.format_cell` type (h/t @victorj2307)
- duktape niggles
- demo cleanup
2018-03-12 22:51:54 -04:00
..
.gitignore version bump 0.11.18: infrastructure 2018-01-23 04:07:55 -05:00
fuse.js version bump 0.11.18: infrastructure 2018-01-23 04:07:55 -05:00
index.html version bump 0.12.5: ancillary utility update 2018-03-12 22:51:54 -04:00
Makefile version bump 0.11.18: infrastructure 2018-01-23 04:07:55 -05:00
README.md demo refresh [ci skip] 2018-01-26 19:52:46 -05:00
sheetjs.ts version bump 0.11.18: infrastructure 2018-01-23 04:07:55 -05:00

FuseBox

This library is built with some dynamic logic to determine if it is invoked in a script tag or in nodejs. FuseBox does not understand those feature tests, so by default it will do some strange things.

TypeScript Support

As with most TS modules in FuseBox, the glob import form should be used:

import * as XLSX from 'xlsx';

The included sheetjs.ts script will be transpiled and bundled to server.js for the "node" target and client.js for the "browser" target.

Proper Target Detection

Out of the box, FuseBox will automatically provide shims to browser globals like process and Browser. The proper way to detect node uses process:

if(typeof process != 'undefined' && process.versions && process.versions.node) {
  /* Script is running in nodejs */
} else {
  /* Script is running in a browser environment */
}

Server Target

The FuseBox documentation configuration can be used as-is:

const fuse = FuseBox.init({
  homeDir: ".",
  target: "node",
  output: "$name.js"
});
fuse.bundle("server").instructions(">sheetjs.ts"); fuse.run();

Browser Target

The native shims must be suppressed for browser usage:

const fuse = FuseBox.init({
  homeDir: ".",
  target: "browser",
  natives: {
    Buffer: false,
    stream: false,
    process: false
  },
  output: "$name.js"
});
fuse.bundle("client").instructions(">sheetjs.ts"); fuse.run();

Analytics