DEV Community

Discussion on: webpack 5 - tutorial for building multipage website

Collapse
 
ourmaninindia profile image
Alfred Tuinman

So far so good but I am stuck as to how I can add database content at a pre-render stage so that ejs templating can be used? I don't want to do DOM manipulation.

Collapse
 
marcinwosinek profile image
Marcin Wosinek

sounds more like a job for a tool like NextJs. Doing it with webpack will be probably doable - the is plenty of loaders etc. but I'm afraid you will get to uncharted territory pretty fast.

Collapse
 
ourmaninindia profile image
Alfred Tuinman

I am a plain vanilla user so I don't think NextJs is my cup of tea.

Thread Thread
 
marcinwosinek profile image
Marcin Wosinek

What DB you want to connect to? Is it something that could be replaced with flat MD or text files in the repo?

Thread Thread
 
ourmaninindia profile image
Alfred Tuinman

actually I am using fetch to connect to the url which links to a MS-SQL database. It's a large db and the site I am converting from a Delphi based program to a microservice.

Thread Thread
 
marcinwosinek profile image
Marcin Wosinek

For me it sounds you are more in static page generation area, and less in the JS applications where webpack thrives.

You can consider:

  • writing a script to load the existing content, to include it in the new repository. Downside - you will replace DB with static files in the repo. This will change the workflow with content authoring. Once you have content locally, you will need to figure out importing it with wepback
  • use similar script, but on the build time. So data will live where you have it now, and each build will reload it's current state
  • write an application that loads data dynamically, from the browser