classes vs. modules is the wrong question
The question you are looking for is classes vs. prototypes.
Both classes and prototypes are used by modules.
Modules (ES2015 Modules) are what JavaScript uses to be able to export and import code. Before JavaScript officially implemented modules there were hacks to do this and create code encapsulation which fixed issues such as pollution of the global scope; Immediately Invoked Function Expressions is an example. Node.js with CommonJS and Angular with AMD and several others tried to figure out how to do this in a better way and implemented their own 'module' system. I would like to think ES2015 Modules were influenced by other languages and CommonJS/Amd etc. and as a result, we now have a module system in JavaScript.
As for classes, they themselves create code encapsulation, but they cannot export themselves, that's what modules do. The same applies for the prototype based code, it creates code encapsulation but cannot export it self just like classes.
Now to put this together.
Example of a module, this example has nothing to do with classes or prototypes, only-a-module.js:
const privateHello = 'hello' // <- module code (private)
export const publicHello = 'hello'; // <- module code (public)
Example of a module that uses a class, module-that-exports-a-class.js:
export class Classes { // <- module AND class code (public)
private privateHello = 'hello'; // <- class code (private)
public publicHello = 'hello'; // <- class code (public)
} // <- class code (public)
const anotherPrivateHello = 'hello'; // <- module code (private)
export const anotherPublicHello = 'hello'; // <- module code (public)
Example of a module that uses prototypes, module-that-exports-a-prototype.js:
export function Prototypes() { // <- module AND prototype code (public)
const privateHello = 'hello'; // <- prototype code (private)
this.publicHello = 'hello'; // <- prototype code (public)
} // <- prototype code (public)
const anotherPrivateHello = 'hello'; // <- module code (private)
export const anotherPublicHello = 'hello'; // <- module code (public)
What makes this confusing to beginners coming from OOP languages is that for example in Java a class file (file.class) is automatically exported as a class, this is by default as this is how Java works. This is not the case in JavaScript. You must state what you are exporting.
Classes are an attempt to implement so called classical inheritance while prototype is, you guessed it, prototypal inheritance. These are two ways to deal with code-reuse and objects that keep their own state.
If we want to make things even more complicated, a good followup question is OOP vs. functional programming. But you can read that up in other places.