modern-netcdf
Version:
Modern NetCDF file reader and utilities
15 lines (14 loc) • 763 B
JavaScript
/* Auto-generated shim choosing the correct worker implementation at runtime.
* In Node environments we simply require the CommonJS worker that uses `worker_threads`.
* In browsers (where `require` is undefined) we fall back to a minimal ES-module stub
* that wires up the same message protocol via `import()`.
*/
/* eslint-disable global-require */
if (typeof require === 'function' && typeof process !== 'undefined' && process.versions && process.versions.node) {
// Node.js – delegate to the existing implementation.
module.exports = require('./node-worker');
} else {
// Browser – dynamically import the ES-module version. We intentionally avoid
// top-level `import` to keep this file CommonJS-compatible.
import('./browser-worker.js');
}