Why do I get “TypeError: Class extends value undefined is not a constructor or null” when trying to run...












0














I have a simple application that is imported from webpack. The imported project exports a class like this...



export class BaseApp{...}

import { BaseApp } from "./MyClass"
import OtherThing from "./Other"
....
export { BaseApp, OtherThing }


Next I try to extend it in another node/express project...



import { BaseApp } from "@mine/util";

export class FullApp extends BaseApp{... }


I get...



class FullApp extends _mine_util__WEBPACK_IMPORTED_MODULE_0__["BaseA
pp"]{
^

TypeError: Class extends value undefined is not a constructor or null


How do I extend a class I am importing from Webpack?



Update here is an example project that demonstrates the issue...



https://github.com/jrgleason/simple-webpack-node










share|improve this question




















  • 1




    You might not be importing BaseApp properly. However, we wouldn't be able to tell without knowing how it is exported.
    – Felix Kling
    Nov 20 at 22:06










  • What do you mean I am showing you how it is exported? Do I need to show it another way like after Webpack?
    – JGleason
    Nov 21 at 13:57










  • If I use it inside the lib that it is declared it works fine. So the actual declaration is fine.
    – JGleason
    Nov 21 at 13:58












  • Your are not showing how ./MyClass exports the class.
    – Felix Kling
    Nov 21 at 15:52










  • Yeah I am I added that at the top and even then It is working in non node projects so I don't get it. I will made a simple project I will add that...
    – JGleason
    Nov 21 at 15:55
















0














I have a simple application that is imported from webpack. The imported project exports a class like this...



export class BaseApp{...}

import { BaseApp } from "./MyClass"
import OtherThing from "./Other"
....
export { BaseApp, OtherThing }


Next I try to extend it in another node/express project...



import { BaseApp } from "@mine/util";

export class FullApp extends BaseApp{... }


I get...



class FullApp extends _mine_util__WEBPACK_IMPORTED_MODULE_0__["BaseA
pp"]{
^

TypeError: Class extends value undefined is not a constructor or null


How do I extend a class I am importing from Webpack?



Update here is an example project that demonstrates the issue...



https://github.com/jrgleason/simple-webpack-node










share|improve this question




















  • 1




    You might not be importing BaseApp properly. However, we wouldn't be able to tell without knowing how it is exported.
    – Felix Kling
    Nov 20 at 22:06










  • What do you mean I am showing you how it is exported? Do I need to show it another way like after Webpack?
    – JGleason
    Nov 21 at 13:57










  • If I use it inside the lib that it is declared it works fine. So the actual declaration is fine.
    – JGleason
    Nov 21 at 13:58












  • Your are not showing how ./MyClass exports the class.
    – Felix Kling
    Nov 21 at 15:52










  • Yeah I am I added that at the top and even then It is working in non node projects so I don't get it. I will made a simple project I will add that...
    – JGleason
    Nov 21 at 15:55














0












0








0







I have a simple application that is imported from webpack. The imported project exports a class like this...



export class BaseApp{...}

import { BaseApp } from "./MyClass"
import OtherThing from "./Other"
....
export { BaseApp, OtherThing }


Next I try to extend it in another node/express project...



import { BaseApp } from "@mine/util";

export class FullApp extends BaseApp{... }


I get...



class FullApp extends _mine_util__WEBPACK_IMPORTED_MODULE_0__["BaseA
pp"]{
^

TypeError: Class extends value undefined is not a constructor or null


How do I extend a class I am importing from Webpack?



Update here is an example project that demonstrates the issue...



https://github.com/jrgleason/simple-webpack-node










share|improve this question















I have a simple application that is imported from webpack. The imported project exports a class like this...



export class BaseApp{...}

import { BaseApp } from "./MyClass"
import OtherThing from "./Other"
....
export { BaseApp, OtherThing }


Next I try to extend it in another node/express project...



import { BaseApp } from "@mine/util";

export class FullApp extends BaseApp{... }


I get...



class FullApp extends _mine_util__WEBPACK_IMPORTED_MODULE_0__["BaseA
pp"]{
^

TypeError: Class extends value undefined is not a constructor or null


How do I extend a class I am importing from Webpack?



Update here is an example project that demonstrates the issue...



https://github.com/jrgleason/simple-webpack-node







node.js webpack ecmascript-6






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 17:28

























asked Nov 20 at 21:34









JGleason

12910




12910








  • 1




    You might not be importing BaseApp properly. However, we wouldn't be able to tell without knowing how it is exported.
    – Felix Kling
    Nov 20 at 22:06










  • What do you mean I am showing you how it is exported? Do I need to show it another way like after Webpack?
    – JGleason
    Nov 21 at 13:57










  • If I use it inside the lib that it is declared it works fine. So the actual declaration is fine.
    – JGleason
    Nov 21 at 13:58












  • Your are not showing how ./MyClass exports the class.
    – Felix Kling
    Nov 21 at 15:52










  • Yeah I am I added that at the top and even then It is working in non node projects so I don't get it. I will made a simple project I will add that...
    – JGleason
    Nov 21 at 15:55














  • 1




    You might not be importing BaseApp properly. However, we wouldn't be able to tell without knowing how it is exported.
    – Felix Kling
    Nov 20 at 22:06










  • What do you mean I am showing you how it is exported? Do I need to show it another way like after Webpack?
    – JGleason
    Nov 21 at 13:57










  • If I use it inside the lib that it is declared it works fine. So the actual declaration is fine.
    – JGleason
    Nov 21 at 13:58












  • Your are not showing how ./MyClass exports the class.
    – Felix Kling
    Nov 21 at 15:52










  • Yeah I am I added that at the top and even then It is working in non node projects so I don't get it. I will made a simple project I will add that...
    – JGleason
    Nov 21 at 15:55








1




1




You might not be importing BaseApp properly. However, we wouldn't be able to tell without knowing how it is exported.
– Felix Kling
Nov 20 at 22:06




You might not be importing BaseApp properly. However, we wouldn't be able to tell without knowing how it is exported.
– Felix Kling
Nov 20 at 22:06












What do you mean I am showing you how it is exported? Do I need to show it another way like after Webpack?
– JGleason
Nov 21 at 13:57




What do you mean I am showing you how it is exported? Do I need to show it another way like after Webpack?
– JGleason
Nov 21 at 13:57












If I use it inside the lib that it is declared it works fine. So the actual declaration is fine.
– JGleason
Nov 21 at 13:58






If I use it inside the lib that it is declared it works fine. So the actual declaration is fine.
– JGleason
Nov 21 at 13:58














Your are not showing how ./MyClass exports the class.
– Felix Kling
Nov 21 at 15:52




Your are not showing how ./MyClass exports the class.
– Felix Kling
Nov 21 at 15:52












Yeah I am I added that at the top and even then It is working in non node projects so I don't get it. I will made a simple project I will add that...
– JGleason
Nov 21 at 15:55




Yeah I am I added that at the top and even then It is working in non node projects so I don't get it. I will made a simple project I will add that...
– JGleason
Nov 21 at 15:55

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53401920%2fwhy-do-i-get-typeerror-class-extends-value-undefined-is-not-a-constructor-or-n%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53401920%2fwhy-do-i-get-typeerror-class-extends-value-undefined-is-not-a-constructor-or-n%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Feedback on college project

Futebolista

Albești (Vaslui)