Skip to content

Commit

Permalink
Merge 5682820 into 05d6303
Browse files Browse the repository at this point in the history
  • Loading branch information
intellix committed Oct 17, 2019
2 parents 05d6303 + 5682820 commit 47e6380
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions posthtml-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = function(options, foundEntries) {
tag: 'script',
attrs: {
src: true,
nomodule: false,
},
});
}
Expand Down
18 changes: 17 additions & 1 deletion test/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,14 @@ describe('preload', function() {
.expect(200, done);
});

it('should create Link header for mutliple scripts', function(done) {
it('should ignore nomodule scripts', function(done) {
request(this.server)
.get('/blog/nomodule-script')
.expect('Content-Type', 'text/html; charset=utf-8')
.expect(200, done);
});

it('should create Link header for multiple scripts', function(done) {
request(this.server)
.get('/blog/multi-script')
.expect('Content-Type', 'text/html; charset=utf-8')
Expand Down Expand Up @@ -425,6 +432,15 @@ function createServer(options) {
},
});

router.route('/blog/nomodule-script', {
GET: function(req, res) {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/html; charset=utf-8');
res.write('<script src="/jquery.min.js" nomodule defer></script>');
res.end();
},
});

router.route('/blog/multi-script', {
GET: function(req, res) {
res.statusCode = 200;
Expand Down

0 comments on commit 47e6380

Please sign in to comment.