ts-ebml icon indicating copy to clipboard operation
ts-ebml copied to clipboard

TypeError: Cannot read properties of undefined (reading 'readVint')

Open juan-foegen-advantive opened this issue 1 year ago • 8 comments

Trying to upgrade from 2.x to 3.x in my Angular project and receiving the error message: TypeError: Cannot read properties of undefined (reading 'readVint')

I didn't see any docs about changes from 2.x to 3.x, so I just updated the library and thought I would give it try. I think it is complaining about tools. I am using - const refinedMetadataBuf = ebml.tools.makeMetadataSeekable(..) or just tools.makeMetadataSeekable with import * as ebml from 'ts-ebml' and import { Decoder, tools, Reader} from 'ts-ebml' respectively. I also tried to alias the include of the tools in case of conflict.

Is there another dependent library I need to include with the 3.x Version?

Thanks.

juan-foegen-advantive avatar Aug 27 '24 12:08 juan-foegen-advantive

Same here in React. It is trying to import tools from ebml

juanreynolds avatar Sep 09 '24 10:09 juanreynolds

You would need to rewire React webpack and include Ebml and Buffer

onthegit avatar Sep 18 '24 10:09 onthegit

You would need to rewire React webpack and include Ebml and Buffer

what do you mean? could you please provide a code/solution?

moo2k avatar Sep 28 '24 20:09 moo2k

Anyone able to get this to work with Angular?

sjames1958gm avatar Nov 05 '24 18:11 sjames1958gm

I didn't try and to deep to find out why but so far only way I would make it work, more or less

Include EBML.js in your public folder <script ....

import {
  type EBMLElementDetail,
  
} from 'ts-ebml';
declare var EBML: typeof import('ts-ebml');



elribonazo avatar Dec 06 '24 00:12 elribonazo

Same problme in Nuxt 3 (Vue 3).

Droppix avatar Feb 19 '25 09:02 Droppix

Solved in Vite using:

import commonjs from "vite-plugin-commonjs";
import { nodePolyfills } from 'vite-plugin-node-polyfills'

...

export default defineConfig({
  ...
  plugins: [
    nodePolyfills({
      include: ['buffer'],
      globals: {
        Buffer: true,
      },
    }),
    commonjs({
      filter(id) {
        return id.includes('node_modules/ts-ebml')
      },
    }),
    ...
  ],
})

maybephilipp avatar Jun 19 '25 07:06 maybephilipp

Also met this in nextjs15, what should I do ?

fatpandaria avatar Oct 21 '25 09:10 fatpandaria

nuxtjs4 fix by import * as ebml from "ts-ebml/dist/EBML.min.js";

aiThanet avatar Dec 19 '25 07:12 aiThanet