finsweet/developer-starter

Create multiples files when I build a project with pnpm build.

Closed this issue ยท 2 comments

Hi !

Is there a way with the Developer Starter Template to create multiples bundles when I 'pnpm build' ?

I was wondering if we can have a main index.js that will load in the Webflow Project Settings and an index-thisTypeOfPage.js for specific pages.
With this I can have a large amount of page loading superfast with only the index.js, and a few more robust pages loading the everything with index.js + the special needs with index-thisTypeOfPage.js.

Trully love your work !
Have a great day ! ๐Ÿ™

Hello @monolithstd, is this what you are looking for?

See this line:
https://github.com/finsweet/developer-starter/blob/master/bin/build.js#L9

You can have your entry points setup like this:

const ENTRY_POINTS = [
   'src/index.ts',
   'src/another/page.ts',
   'src/utils/index.ts',
   'src/settings/auth.ts',
   // add more entry points
];

then when you run pnpm dev, you can get your bundled outputs like:

Built files: [  
  'http://localhost:3000/index.js',
  'http://localhost:3000/another/page.js',  
  'http://localhost:3000/utils/index.js',
  'http://localhost:3000/settings/auth.js',
  ]

and when you pnpm build, you'll get the respective bundled outputs as set in your entry points.

Thank you for answering @robertkibet .
@monolithstd if your question was solved, I'll proceed to close this issue.