rii-mango / NIFTI-Reader-JS

A JavaScript NIfTI file format reader.
MIT License
137 stars 30 forks source link

Uncaught ReferenceError: nifti is not defined" #32

Closed AkiiLucky closed 1 year ago

AkiiLucky commented 1 year ago

Uncaught ReferenceError: nifti is not defined"

HuangJia-Le commented 1 year ago

I also have this problem.

iamiota commented 1 year ago

import * as nifti from 'nifti-reader-js'

Try it.

1isten commented 1 year ago

cdn version missing nifti global var

hanayik commented 1 year ago

@AkiiLucky , @iamiota , @1isten , @HuangJia-Le ,

I have submitted a new PR (#33) that should address this. When we switch to typescript and esbuild there was a flag omitted which meant we were not building the ESmodule properly. When #33 is merged in, you should be able to use nifti-reader-js from the npm CDN as long as you specify that your <script> tags are modules like this:

<script type="module">
    import * as nifti from './nifti-reader.js';
    window.nifti = nifti.default;
    console.log(nifti);
</script>