diff --git a/src/index.js b/src/index.js index 9e1e7807..aa74c66d 100644 --- a/src/index.js +++ b/src/index.js @@ -43,6 +43,7 @@ export default function htmlLoader(source) { let offset = 0; for (const link of links) { if ( + link.value && isUrlRequest(link.value, options.root) && !link.value.includes('mailto:') ) { diff --git a/test/loader.test.js b/test/loader.test.js index 1ff52b07..934cf80c 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -7,13 +7,14 @@ describe('loader', () => { it('should convert to requires', () => { const result = loader.call( {}, - 'Text Text' + 'Text Text ' ); expect(result).toBe( - `${GET_URL_CODE}module.exports = "Text Text";` + `${GET_URL_CODE}module.exports = "Text Text ";` ); }); + it('should accept attrs from query', () => { const result = loader.call( {