3 ms·
Alternatively, you can use a simple web-server without needing all of webpack: using npx (included with npm): npx serve . using the php CLI: php -S
by Kwantuum 7y ago
Alternatively, you can use a simple web-server without needing all of webpack:
using npx (included with npm):
npx serve .
using the php CLI:
php -S localhost:5000 -t .
You weren't hitting the limits of vanilla JS, you were hitting the limit of reading files directly from disk instead of through a web server.
- Dangeranger 7y agoThis is a good point, the fact that browsers won’t load JS modules over the file:// protocol is not the fault of JavaScript.
- staz 7y agoor in python 2 (should be on installed by default on most distro): python -m SimpleHTTPServer or python3 : python -m http.server
- sjf 7y agoSeriously, the poster is going to have to host their files somewhere eventually if they intend anyone else to ever see it. I can't believe they rewrote all their JS because they were forced to access over http:// http:// instead of file://. This seems nonsensical.
- Kwantuum 7y agoHey, never used python's http server, that's just as nice and easy as the two solutions I proposed, thanks for the tip!
- Jasp3r 7y agoA simple web-server only does that: serving a website. With a proper webpack setup, you get imports/exports, (node) module bundling, live reloading which all massively improve your development speed. However I wouldn't recommend anyone to build their own webpack config if you don't know exactly what you're doing. Just use parcel: https://parceljs.org/ https://parceljs.org/
- hombre_fatal 7y agoThere's also Parcel: https://parceljs.org/ https://parceljs.org/ It does many things an advanced Webpack project does, but without any config. I use Parcel as long as possible and then switch to lower-level Webpack when I need more control. Easier way to start a new project.