diff --git a/packages/core/integration-tests/test/html.js b/packages/core/integration-tests/test/html.js index 7b3ee6da5cf..31ce79fd64f 100644 --- a/packages/core/integration-tests/test/html.js +++ b/packages/core/integration-tests/test/html.js @@ -296,6 +296,18 @@ describe('html', function() { assert(html.includes('Other page')); }); + it('should work with an empty html file', async function() { + let inputFile = path.join(__dirname, '/integration/html-empty/index.html'); + await bundle(inputFile, { + minify: false + }); + + let outputFile = path.join(__dirname, '/dist/index.html'); + + let html = await fs.readFile(outputFile, 'utf8'); + assert.equal(html.length, 0); + }); + it('should read .htmlnanorc and minify HTML in production mode', async function() { await bundle( path.join(__dirname, '/integration/htmlnano-config/index.html'), diff --git a/packages/core/integration-tests/test/integration/html-empty/index.html b/packages/core/integration-tests/test/integration/html-empty/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/core/parcel-bundler/src/assets/HTMLAsset.js b/packages/core/parcel-bundler/src/assets/HTMLAsset.js index e2646c7fbee..f308759cb04 100644 --- a/packages/core/parcel-bundler/src/assets/HTMLAsset.js +++ b/packages/core/parcel-bundler/src/assets/HTMLAsset.js @@ -204,59 +204,61 @@ class HTMLAsset extends Asset { async generate() { // Extract inline