Skip to content Skip to sidebar Skip to footer

Export 'default' (imported As 'n') Was Not Found In './n'

I want to include namespace of modules, and when I do it, it gives me warning, (and my code won't work), I'm importing my module like that import * as agl from './agl'; And using

Solution 1:

Default exports should be imported this way:

import agl from"./agl";

Your code isn't working because you are trying to import all the named exports.

Check this to learn more about this.

Solution 2:

exportdefault {
  VertexArray,
  Display,
  VertexBuffer,
  IndexBuffer,
  Shader,
  ShaderProgram,
  Texture,
  BufferLayout
}

This is horrible, and causing your problem. That module does default-export an object literal, instead of just using named exports. You should be using

export {
  VertexArray,
  Display,
  VertexBuffer,
  IndexBuffer,
  Shader,
  ShaderProgram,
  Texture,
  BufferLayout
}

instead to have your import * as agl … work.

Post a Comment for "Export 'default' (imported As 'n') Was Not Found In './n'"