Skip to content

Enable Parcel multiple entry points #4

@aarongarciah

Description

@aarongarciah

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 parcel-bundler/parcel#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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions