This may help you: https://youtu.be/EcBvG4uY93o.
If it is not enough, you'll have to use scripting and implement a ray-tracing algorithm for intersection with cubes. This will be very inefficient and so you won't be able to have many cubes, unless you find a smart optimization.
First, have an array (a JavaScript array) with information about every cube in the game world. Each element in the array should contain a cube's position and edge size.
Then, every frame,
1. Shoot a ray from the center of the camera to the mouse position.
2. Check collision of this ray against all cubes in the cube array.
3. Get the closest cube which collides with the ray. This is the cube upon which a block must be placed if the player hits the button to place a block.