Dumber Bundler - index.html

I am playing around with the Dumber Bundler and I set up a test project using npx makes dumberjs.

The project skeleton contains an _index.html file, which is the basis for the generated index.html file. However, when building the app, the index.html file seems to be generated in the project’s root directory instead of in the dist directory.

Is there a (hopefully easy) way to let the bundler generate the index.html file inside the dist directory (and let it correctly refer to the generated JavaScript files in the dist directory as well) so that the dist directory contains a complete set of files to deploy?

You are not the only one requested this. I might update both au1 and au2 skeletons so all the build artifacts are in same output folder.

It’s all controlled in gulpfile. The index.html is in a callback of dumber option. The dist/*bundle.js are written by gulp.dest.

You can change the output of index to dist/index.html, and

  1. Option1, gulp.dest to dist/dist so that index and js bundles keep same relative path.
  2. Option2, don’t change gulp.dest, but update dumber options to baseUrl: '/' and remove dist from the path of js in _index.html.

You also need to update the dev server so it serves from dist folder instead of project root.

2 Likes

Hi @huochunpeng

Thank you for these inspirational suggestions.
:bulb:

I will post my findings here when I am ready.