Skip to content

Instantly share code, notes, and snippets.

@ziyuang
Created July 30, 2020 18:55
Show Gist options
  • Save ziyuang/30f135a2405bbeeb004fe4c8a05e8f5c to your computer and use it in GitHub Desktop.
Save ziyuang/30f135a2405bbeeb004fe4c8a05e8f5c to your computer and use it in GitHub Desktop.
Reproducing `hdf5.File is not a constructor`
import { hdf5 } from 'hdf5';
import { Access } from 'hdf5/lib/globals';
let f = new hdf5.File('test.hdf5', Access.ACC_RDONLY);
{
"name": "hdf5_test",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"hdf5": "https://github.com/HDF-NI/hdf5.node#v12"
},
"devDependencies": {
"file-loader": "^6.0.0",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
}
}
const path = require('path');
module.exports = {
entry: './index.js',
target: 'node',
module: {
rules: [
{
test: /\.node$/,
use: 'file-loader'
},
],
},
mode: 'development',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist')
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment