1

While recently creating a module for shared functionality between our projects I stumbled upon this question. Should the module be occupied with transpilation of code to older browsers that our projects, in general, should support or should it only contain the essential functionality, assuming compatibility to be an issue of the user.

Would the answer be different if I was creating a module for the general public?

1 Answer 1

2

I strongly believe the later one is the right answer: You module should only contain the essential functionality. Modules which are simply libraries in other words, often get messy when they don't have a clear feature scope. That is also true for every thing in software development. I would also not differ between general public libraries and internal libraries, people are more lazy for their internal stuff, but this will get its revenge later.

You can also see this by how the npm ecosystem and modern javascript development works: You have your code and your modules, and to transpile it for older browsers the top level, library using project decides if it uses eslint for example for trans piling. All the library/module and application code will later get stuffed into one big ugly file anyway. And often applications don't need the trans pile. Just look at the react app project template, where you can see this common pattern.

3
  • I made the distinction between internal and public since usage for internal purposes means you have a clear perspective of the whole system(module and application that uses it alike), while when releasing something publicly you re not aware of where and how people will use your module and what specifications it should have. Thanks for the link(as well as for the answer in general), I 'll give it a look.
    – Leon
    Oct 18, 2019 at 12:02
  • 1
    That " clear perspective of the whole system" is often an illusion and a contradiction in itself. You have a module/library because you share the functionality between applications right? Right now you might know what the applications do and need, but this will probably change in the future. Also you won't gain much, your library should not care. You won't loose anything, you can still trans pile later, if you need to. Oct 18, 2019 at 12:07
  • 1
    Indeed, this module is to share functionality between applications. I think im leaning towards the later as well but wanted to see people's perspective on it. I ll accept your answer if nothing more enlightening comes over the weekend.
    – Leon
    Oct 18, 2019 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.