Welcome to the forum.
Have a look at
https://medium.com/the-node-js-collection/modern-javascript-explained-for-dinosaurs-f695e9747b70
to understand why.
The p5.js Getting Started is using classic script - which tends to just dump everything in the global namespace. The import
in the app.js
is an indication that you are dealing with ES2015 module script which improve isolation and webpack is one of many bundlers designed to assemble a page bundle from many modules.