Skip to content

Commit

Permalink
Fix dev server index file (#281)
Browse files Browse the repository at this point in the history
* Fix dev server index file

When using custom template Asset (like parcel-plugin-pug) with `parcel src/index.pug` it generates correct index.html,
but basename of file is index.pug rather than index.html, so server sends incorrect file.

* Rewrited with using generateBundleName method. Thanks to @devongovett
  • Loading branch information
Ty3uK authored and devongovett committed Dec 15, 2017
1 parent f62d476 commit c008bb0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function middleware(bundler) {
function sendIndex() {
// If the main asset is an HTML file, serve it
if (bundler.mainAsset.type === 'html') {
req.url = '/' + bundler.mainAsset.basename;
req.url = `/${bundler.mainAsset.generateBundleName(true)}`;
serve(req, res, send404);
} else {
send404();
Expand Down

0 comments on commit c008bb0

Please sign in to comment.