parcel-static-boilerplate icon indicating copy to clipboard operation
parcel-static-boilerplate copied to clipboard

Enable Parcel multiple entry points

Open aarongarciah opened this issue 5 years ago • 1 comments

Right now, the entry point of the app is the src/index.njk file. That means that only files referenced in the src/index.njk. For example, the src/about.njk is not being processed because is not referenced inside the src/index.njk.

Solution Change the dev script in the package.json to use every .njk file directly under the src/ folder as an entry point.

-"dev": "NODE_ENV=development parcel src/index.njk --open",
+"dev": "NODE_ENV=development parcel src/*.njk --open",

Problems Using a multiple entry point, when running the npm run dev script Parcel opens url http://localhost:1234/ but a 404 error is shown, which is very confusing and can lead people to think that the development server is not working properly. Parcel has an opened issue regarding this https://github.com/parcel-bundler/parcel/issues/1315.

The expected behaviour is that http://localhost:1234/ shows the generated index.html, just like when we're using a single entry point for Parcel.

A workaround could be to remove the --open param to avoid Parcel opening automatically http://localhost:1234/ and open manually http://localhost:1234/index.html to avoid the confusion for developers.

aarongarciah avatar Jul 18 '19 15:07 aarongarciah

A workaround for this https://github.com/parcel-bundler/parcel/issues/1315#issuecomment-523524186 until this is fixed by Parcel.

aarongarciah avatar Oct 02 '19 13:10 aarongarciah