Skip to content

TypeError: I is not a function when calling loadSpz/loadSpzFromUrl` in Node.js and Browser (@spz-loader/[email protected])Β #70

@ChristenJacquottet

Description

@ChristenJacquottet

Package Version: @spz-loader/[email protected]

Problem Description:

When attempting to load an .spz file using either loadSpz or loadSpzFromUrl from @spz-loader/[email protected], a runtime error occurs. This error happens both when running the library in a browser environment (specifically tested within an A-Frame component loaded via <script type="module"> from esm.sh) and when running it directly in a standard Node.js environment.

Error Message & Stack Trace:

TypeError: I is not a function
    at file:///path/to/project/node_modules/@spz-loader/core/dist/index.js:11:16
    at async OI (file:///path/to/project/node_modules/@spz-loader/core/dist/index.js:799:13) 

Steps to Reproduce (Node.js):

  1. Install the package: npm install @spz-loader/[email protected] or pnpm add @spz-loader/[email protected]
  2. Create a simple index.js file:
    import { loadSpzFromUrl } from '@spz-loader/core'; 
    // Or: import { loadSpz } from '@spz-loader/core'; and use fetch + loadSpz(buffer)
    
    const spzUrl = 'https://huggingface.co/datasets/christenJacquottet/gaussian-splats/resolve/main/train.spz'; // Example URL
    
    async function runTest() {
        console.log(`Attempting to load SPZ from: ${spzUrl}`);
        try {
            // Using loadSpzFromUrl (also fails with fetch + loadSpz(buffer))
            const splat = await loadSpzFromUrl(spzUrl); 
            console.log('SPZ Loaded successfully! Points:', splat.numPoints);
        } catch (error) {
            console.error('Error loading SPZ file:', error);
        }
    }
    
    runTest();
  3. Run the script: node index.js
  4. Observe the TypeError: I is not a function error in the console.

Environment:

  • Package: @spz-loader/core version 0.2.0
  • Node.js: v20.17.0
  • **Browser Chrome, running within A-Frame Version 1.5.0 and 8th Wall. Library loaded via <script type="module" src="https://esm.sh/@spz-loader/[email protected]">.

Since the error occurs identically in Node.js, it strongly indicates the issue lies within the package's build/bundling rather than the specific browser or A-Frame environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    πŸ”– Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions