Creating a new package using ES6/babel

Hi folks,

I’m having an issue with my custom package not bringing in ‘modules’ from other source files. Atom is in this in-between state where a lot of it is coffeescript and the consensus is new stuff should be javascript.

I’m confused about how to bring in other code files into a javascript file. Is it the case that if we write code in coffeescript we need to be using ‘require “foobar”’ and if we are writing in javascript then we need to use ES6 import/export concepts like ‘import foobar from “foobar”’?

I have this weird problem where my class is not visible and the context sees the classname as an empty object. The class was originally written as .coffee and I converted it to javascript however I am still using node (commonjs?) require statements in my javascript file.

How does atom resolve all of this? It seems I’ve been using require/import indifferently and the error “testcase-panel.js? [sm]:26 Uncaught (in promise) TypeError: TestCasesModel is not a constructor” has taken me on this path. I am not sure exactly why the class def’n is not available as I do “const TestCaseModel = require(’./testcase-model’)” at the top of the file.

Any insights are muchly appreciated!

Wild guess: did you instantiate the class?

Better approach: could you please post a MRE (Minimal, Reproducible Example), so people get a vague understanding of what you currently got?