{"_id":"html-webpack-multi-build-plugin","_rev":"2-a796f3c145351423ed4f0b76e60b4f49","name":"html-webpack-multi-build-plugin","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"html-webpack-multi-build-plugin","version":"1.0.0","description":"simplifies creation of HTML file for multi-build configuration","main":"index.js","repository":{"type":"git","url":"git+https://github.com/firsttris/html-webpack-multi-build-plugin.git"},"keywords":["webpack","plugin","html-webpack-plugin","multi-build","module","nomodule","template"],"author":{"name":"Tristan Teufel","email":"tristanteufel@gmail.com","url":"https://github.com/firsttris"},"license":"ISC","bugs":{"url":"https://github.com/firsttris/html-webpack-multi-build-plugin/issues"},"homepage":"https://github.com/firsttris/html-webpack-multi-build-plugin#readme","gitHead":"ea44cc8ce4fdd81b968ef82fd5ac79c2851a0878","_id":"html-webpack-multi-build-plugin@1.0.0","_npmVersion":"6.3.0","_nodeVersion":"10.8.0","_npmUser":{"name":"firsttris","email":"tristanteufel@googlemail.com"},"dist":{"integrity":"sha512-hxuTxTmXJ28oAsbEy4G6h+gjro/Qw2st4VNhPUj+uDQKmcxwSvRJucudyAauZRmky2ZmGCVi96m8dcj3oVyakw==","shasum":"255face1f1f8e0f315b206cfa1b7009434ed39ca","tarball":"https://registry.npmjs.org/html-webpack-multi-build-plugin/-/html-webpack-multi-build-plugin-1.0.0.tgz","fileCount":5,"unpackedSize":7630,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbJCzCRA9TVsSAnZWagAACTgQAJgorVVwU95+1NbfWcXR\n4kWF3zO7TUTKt/r4PAETPRgd6LYBW/PrKzuToD/ibwqmdUpdg5BtCk2hKx0f\nMxtPPNArgYdXM2Rq8wyTkeqvnrkh2lV48ntH9YS8SljEzhwexgyv8R8XoCAH\n3+Xz0BZ06sTdBtYHYJHgA/GMlnibpUwmKhE2tNoYDLrhNHz5YeRQQPi/2s2Q\n+kH8IPESk+7hFhTGZmjWBk8HLlsd1ZHHCpDOe7iVmEWIbOLYOGiJLZRlmPyX\nxlgsu5Z6K0cRdlJwK8/Jsho4GqsM1JlzRHf7IkqfspwUPiSw7eun5hQVMSZ1\n0c0o6WN7zD7402YXlJ5CDWdre9fAHeynHLi1biNyBHeQYMKzCm+SEklBZFxC\nBG6G6TybDRj2CRd0VVB9HZrfo+P3IjG9OxXVnJBb8hEE2EdhBmjYPOZKPff8\nMD9ocdznEVIUQbjBG1d9I1IhXma+IPdhTYe5nUI3WHJPvN3QiHFIlrEs/qMj\n7YHihkuxiGsJ0ndkUHQUW40RAT1KiS3qbC9AYcAC822fjQcyizi5ugfsdMKP\nsJ9b50LpNKS8oNbDmfgjgkPk5aSWeTEkZZiewC1CDAORCNJom4SoQQNgsJup\ncCmHhaglw9Ev3JQNK90cUuGuTYvEB/x9ROcI9/1Qmb9jiPGaLAMAsRlk2NH2\nVoNh\r\n=e3/C\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFSzaGA+oxfHq4uhprvaZLD28JYOS6sbR7fizWE9fEuuAiAHeR9xVJhMFnYFXHEHIvNvBVLOOJqxlYiYYgJJ6FkyhA=="}]},"maintainers":[{"name":"firsttris","email":"tristanteufel@googlemail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/html-webpack-multi-build-plugin_1.0.0_1533841587107_0.8869516599251823"},"_hasShrinkwrap":false},"1.1.0":{"name":"html-webpack-multi-build-plugin","version":"1.1.0","description":"simplifies creation of HTML file for multi-build configuration","main":"index.js","repository":{"type":"git","url":"git+https://github.com/firsttris/html-webpack-multi-build-plugin.git"},"keywords":["webpack","plugin","html-webpack-plugin","multi-build","module","nomodule","template"],"author":{"name":"Tristan Teufel","email":"tristanteufel@gmail.com","url":"https://github.com/firsttris"},"license":"ISC","bugs":{"url":"https://github.com/firsttris/html-webpack-multi-build-plugin/issues"},"homepage":"https://github.com/firsttris/html-webpack-multi-build-plugin#readme","gitHead":"ef0d4f1c5a2a5273f76df7d8c138b66a016a90c5","_id":"html-webpack-multi-build-plugin@1.1.0","_nodeVersion":"11.15.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-hO0qlhgTtqvF6cPlnx0YArU/056NpydoMzLaccBrXMEakIm+TZ4gZFBSl80t+amoDP3Fg0LvGXGqC1UMJIDIgg==","shasum":"3fe669eb9251650b1719c3782aa0ff0ef501aac0","tarball":"https://registry.npmjs.org/html-webpack-multi-build-plugin/-/html-webpack-multi-build-plugin-1.1.0.tgz","fileCount":5,"unpackedSize":9529,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc9iCjCRA9TVsSAnZWagAA2MsP/1lVcwzPHXWgUtvTHGux\nVq6/H1h9lFI9soe6GVwBG94ia80jb+xoWApKvsUaKv2PTfg9gk4gudgiBFV5\nbtq9ScvJUcwh5i0mUe61W5KlL7SrgzXdUWTj0nkfYfFrHS6EhaStHfPRyWQM\n8tSRx6QF5xgd0KUtflUVY1yVrGphxeBR6RokWYRopffUkqqWPpci3DmkALXw\nkX8W4P9u74xPqE1+Uf6KnpzowkvKDGngAfxNUVy7S7BOaLy76KFH/zikauis\nG8XUT7ihiO8rC8XLpEHtnaVk1CSXsRKawY8H77Nt2VCiiNMx8CvNRUrZ6vET\nUTZmdSABvsPSE4MbVvIn9KuOBytSFB5LFCjwjDUi0MlL0JCdY4wRANk6KcMn\n8WYhO5YjkqmHKHD0nUpO9sLtFNjEUCs85g+Vox2CxKdZnST57HH6KHbLufp8\nGEMwDF9YC4aa+s5rG3M+S332aMwdtTKnlhfNGMnuZquxcvWba14u9VInaS9n\nQ+Iz9qBN5d47rCWwPWhEy6Q/7DuNpifeWWMF/O/HA0ZGwmmgMluQrA+gVQle\nEgg7Zvb/5hbjHJZbvqUrMbrsvJ6ljCiBndQRZjyoPzOj+ByJvIByFEbozUZq\nreK2mRAwrjKS4BLG8Wty/SlaapmNBYl/PtsAoU3Qerp7nRh10luIcAeKAknz\n7s/E\r\n=Hc2M\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCAfsfKkQlM+i6AqMsaQ+0NK7NORzqnByWQEznZOuNwjwIgSdyl/rzp4p4q0ieEtEmZG3N9qtBnsfA4kNC3n8xvj04="}]},"maintainers":[{"name":"firsttris","email":"tristanteufel@googlemail.com"}],"_npmUser":{"name":"firsttris","email":"tristanteufel@googlemail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/html-webpack-multi-build-plugin_1.1.0_1559634082804_0.3529221825325639"},"_hasShrinkwrap":false}},"time":{"created":"2018-08-09T19:06:27.107Z","1.0.0":"2018-08-09T19:06:27.173Z","modified":"2022-05-05T07:22:05.035Z","1.1.0":"2019-06-04T07:41:22.898Z"},"maintainers":[{"name":"firsttris","email":"tristanteufel@googlemail.com"}],"description":"simplifies creation of HTML file for multi-build configuration","homepage":"https://github.com/firsttris/html-webpack-multi-build-plugin#readme","keywords":["webpack","plugin","html-webpack-plugin","multi-build","module","nomodule","template"],"repository":{"type":"git","url":"git+https://github.com/firsttris/html-webpack-multi-build-plugin.git"},"author":{"name":"Tristan Teufel","email":"tristanteufel@gmail.com","url":"https://github.com/firsttris"},"bugs":{"url":"https://github.com/firsttris/html-webpack-multi-build-plugin/issues"},"license":"ISC","readme":"# html-webpack-multi-build-plugin\n\nThis plugin simplifies the creation of script tags for module and nomodule for a webpack multi build configuration.\n\n[![npm version](https://badge.fury.io/js/html-webpack-multi-build-plugin.svg)](http://badge.fury.io/js/html-webpack-multi-build-plugin)\n\n### Why do you want to do this?\n\nMost developers still transpile their code to ES5 and bundle it with polyfills to provide support for older browsers.\nBut for newer browsers this transpiled code is unnecessary and probably slower then ES6+ code.\nThe Idea is to create two bundles, one modern es6+ bundle and one legacy es5 bundle.\n\n### What? How do you do that?\nThe solution is to provide two script tags, one with type=module (es6+ code) and one with \"nomodule\" (es5 code).\nModern Browser will now only load the script tag with type=module while legacy browser only load the script tag with \"nomodule\".\n\n### Will some browser still download both bundles?\n\nSome browser like Safari, IE11, Edge are downloading both bundles, but only executing one. \nThis plugin has integrated a clever fix for this.\nBy creating a script tag with module / nomodule which dynamically injects the actual script tags for the javascript resources.\n\n```\n<script type=\"module\">\n    var script = document.createElement('script');\n    script.type = 'text/javascript';\n    script.src = 'vendors~app_60d33517957366ff05a8.js';\n    document.body.appendChild(script);\n</script>\n```\n\n### Why do i need this addon?\nThis plugin for html-webpack-plugin generates script tags for module and nomodule for a webpack multi build configuration.\n\n### Async CSS Loading\nThe included template add's tags for async (non blocking) css\n```\n<link href=\"app.css\" rel=\"stylesheet\" media=\"nope!\" onload=\"this.media='all'\">\n```\n\n### Read about webpack multi build configuration\nhttps://webpack.js.org/configuration/configuration-types/#exporting-multiple-configurations\n\n### How to use this addon?\n\nCheck out my [Example Project](https://github.com/firsttris/html-webpack-multi-build-plugin/tree/master/example)\n\nSummarized\n\n#### Package.json\n```\n    \"scripts\": {\n        build:multi\": \"webpack --env.build=multi\"\n    }\n```\n\n#### webpack.config\n```  \n    // Legacy webpack config needs to include 'legacy' \n    config.output.filename = '[name]_legacy.js';\n\n    // Modern webpack config must not include 'legacy'\n    config.output.filename = '[name].js';\n\n    // Both webpack configs must include htmlWebpackPlugin and htmlWebpackMultiBuildPlugin\n    const htmlWebpackMultiBuildPlugin = require('html-webpack-multi-build-plugin');\n    const multiBuildMode = process.env.build === 'multi'\n    const template = multiBuildMode \n    ? require.resolve('html-webpack-multi-build-plugin/template.ejs') \n    : require.resolve('html-webpack-plugin/default_index.ejs');\n    \n    config.plugins: [\n        new htmlWebpackPlugin(\n            {\n                inject: !multiBuildMode,\n                template\n            }\n        )\n        new htmlWebpackMultiBuildPlugin()\n    ]\n```\n\n\n### Sources\n\nhttps://philipwalton.com/articles/deploying-es2015-code-in-production-today/    \nhttps://github.com/philipwalton/webpack-esnext-boilerplate    \nhttps://jakearchibald.com/2017/es-modules-in-browsers/    \nhttps://github.com/jantimon/html-webpack-plugin/issues/782    \nhttps://github.com/philipwalton/webpack-esnext-boilerplate/issues/1","readmeFilename":"README.md"}