diff --git a/.bithoundrc b/.bithoundrc deleted file mode 100644 index f0e1b96d..00000000 --- a/.bithoundrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ignore": [ - "**/examples/**", - "**/node_modules/**", - ], - "test": [ - "**/spec/**" - ] -} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..b0bf659d --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: html-webpack-plugin +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..861ef5a3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,43 @@ +--- +name: Bug report +about: Create a 🕷 report to help us improve + +--- + + + +## Current behaviour 💣 + + + +## Expected behaviour ☀️ + + + +### Reproduction Example 👾 + + + +## Environment 🖥 + + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..066b2d92 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/lock.yml b/.github/lock.yml new file mode 100644 index 00000000..b1fa35a6 --- /dev/null +++ b/.github/lock.yml @@ -0,0 +1,14 @@ +# Configuration for lock-threads - https://github.com/dessant/lock-threads + +# Issues and pull requests with these labels will not be locked. Set to `[]` to disable +exemptLabels: [] + +# Label to add before locking, such as `outdated`. Set to `false` to disable +lockLabel: false + +# Comment to post before locking. Set to `false` to disable +lockComment: false + +# Number of days of inactivity before a closed issue or pull request is locked +daysUntilLock: 30 + diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 00000000..8d61aee8 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,16 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 180 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 15 +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + **This issue had no activity for at least half a year.** + It's subject to automatic issue closing if there is no activity in the next 15 days. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..61d5c24d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,37 @@ +name: CI + push: + branches: [main] + pull_request: + branches: [main] +jobs: + build: + name: test Node ${{ matrix.node }} Webpack ${{ matrix.webpack }} ${{ matrix.os }} + timeout-minutes: 15 + + runs-on: ${{ matrix.os }} + strategy: + matrix: + node: ['10.x', '12.x', '14.x'] + os: [ubuntu-latest, windows-latest, macOS-latest] + webpack: ['5'] + + steps: + - name: LF + run: git config --global core.autocrlf false + + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Use Node ${{ matrix.node }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: Install Dependencies + run: npm install --ignore-scripts --force --legacy-peer-deps + + - name: Install Webpack ${{ matrix.webpack }} + run: npm install --ignore-scripts --force --legacy-peer-deps webpack@${{ matrix.webpack }} + + - name: Test + run: npm test -- --forceExit || npm test -- --forceExit || npm test -- --forceExit diff --git a/.gitignore b/.gitignore index 260d8b5d..cae599df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ /node_modules/ /dist/ -npm-debug.log +/coverage/ +npm-debug.*.log +yarn.lock +package-lock.json +npm-debug.log.* diff --git a/.mailmap b/.mailmap new file mode 100644 index 00000000..40fb3a5e --- /dev/null +++ b/.mailmap @@ -0,0 +1,8 @@ +Chris Greening +Jan Nicklas +Jan Nicklas +Ma Cheng +Michał Gołębiowski-Owczarek +Thomas Grainger +Thomas Grainger +Zhanwei Wu diff --git a/.node-version b/.node-version new file mode 100644 index 00000000..db24ab96 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +10.13.0 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cae6ac14..00000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: node_js -node_js: - - "4" - - "5" - - "6" -env: - - WEBPACK_VERSION=1 EXTRACT_PLUGIN_VERSION=1 - - WEBPACK_VERSION=2 EXTRACT_PLUGIN_VERSION=2 - - WEBPACK_VERSION=3 EXTRACT_PLUGIN_VERSION=3.0.0-beta.3 -before_install: - - stty columns 120 -install: - - npm install --ignore-scripts - - npm rm webpack - - npm rm extract-text-webpack-plugin - - npm install webpack@$WEBPACK_VERSION extract-text-webpack-plugin@$EXTRACT_PLUGIN_VERSION --ignore-scripts || true -script: - - npm test diff --git a/CHANGELOG.md b/CHANGELOG.md index 25d1d2d4..e85923e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,265 +1,735 @@ -Change History -============== +# Changelog -v2.30.1 ---- -* Revert part the performance optimization (#723) because of #753. +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [5.5.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.4.0...v5.5.0) (2021-10-25) + + +### Features + +* Support type=module via scriptLoading option ([1e42625](https://github.com/jantimon/html-webpack-plugin/commit/1e4262528ff02a83e1fc7739b42472680fd205c2)), closes [#1663](https://github.com/jantimon/html-webpack-plugin/issues/1663) + +### [5.4.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.3.2...v5.3.3) (2021-10-15) + +### Features + +* update terser ([9c7fba0](https://github.com/jantimon/html-webpack-plugin/pull/1688) + +### [5.3.2](https://github.com/jantimon/html-webpack-plugin/compare/v5.3.1...v5.3.2) (2021-06-22) + +### Bug Fixes + +* update lodash and pretty error ([9c7fba0](https://github.com/jantimon/html-webpack-plugin/commit/9c7fba02d0aa7d9e804863a66eb896db3046f645) + +### [5.3.1](https://github.com/jantimon/html-webpack-plugin/compare/v5.3.0...v5.3.1) (2021-03-09) + + +### Bug Fixes + +* remove loader-utils from plugin core ([82d0ee8](https://github.com/jantimon/html-webpack-plugin/commit/82d0ee8ddf146f17d71e98c1b44b2f2ec7420051)) + +## [5.3.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.2.0...v5.3.0) (2021-03-07) + + +### Features + +* allow to modify the interpolation options in webpack config ([d654f5b](https://github.com/jantimon/html-webpack-plugin/commit/d654f5b90022304335b372d424ff4c08d3a9d341)) +* drop loader-utils dependency ([41d7a50](https://github.com/jantimon/html-webpack-plugin/commit/41d7a50516aefd1af2704e3837d5d41351c6199b)) + +## [5.2.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.1.0...v5.2.0) (2021-02-19) + + +### Features + +* improve ssr ([73d2a66](https://github.com/jantimon/html-webpack-plugin/commit/73d2a660b10b9ebf8a341f0ddb173bcaaf1e513c)) + +## [5.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.0.0...v5.1.0) (2021-02-12) + + +### Features + +* omit html tag attribute with null/undefined/false value ([aa6e78d](https://github.com/jantimon/html-webpack-plugin/commit/aa6e78d1430c17d9cf05550b2c9f73a9a0c0166c)), closes [#1598](https://github.com/jantimon/html-webpack-plugin/issues/1598) + +## [5.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.5.1...v5.0.0) (2021-02-03) + + +### ⚠ BREAKING CHANGES + +* Drop support for `webpack` 4 and `node` <= 10 - For older webpack or node versions please use `html-webpack-plugin` 4.x +* Entry javascript resources are now beeing loaded deferred in the `` tag to improve the page load performance by default - You can set the `scriptLoading` option to `'blocking'` to keep the previous behaviour +* Setting publicPath to `''` (an empty string) will no longer calculate a relative path from the html file to the assets anymore - You can set the `publicPath` option to `'auto'` to keep the previous behaviour +* Plugins for `html-webpack-plugin` which add additional assetTags should provide a `meta` attribute +* Drop support for `appcache-webpack-plugin` + +### Features + +* drop `webpack` 4 and `node` <= 10 support to make use of the latest APIs ([b7a9e8f](https://github.com/jantimon/html-webpack-plugin/commit/b7a9e8f2a3c146cfec8f5c42888abd6aa0cde0b9)) +* use the new webpack 5 APIs and create html files during the new `webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS` compilation stage ([8964bc4](https://github.com/jantimon/html-webpack-plugin/commit/8964bc4182e41807a564d3000217a40bc5f93ad2), [b6895cb](https://github.com/jantimon/html-webpack-plugin/commit/b6895cb5b85b1e6e850f638470cf9b839d421516), [a97234e](https://github.com/jantimon/html-webpack-plugin/commit/a97234ead5ea2dbba07a6e6a70c5ddb6a5a3c288), [1b59e09](https://github.com/jantimon/html-webpack-plugin/commit/1b59e0944f561b264f11847ef245c9fc3f05b80f), [4fca596](https://github.com/jantimon/html-webpack-plugin/commit/4fca5965315c49f6706812d9fdf6c7284d23d75b), [ed64a6b](https://github.com/jantimon/html-webpack-plugin/commit/ed64a6b35fe9cdbc610e9b766700f3b2fc2b8e4c), [86245db](https://github.com/jantimon/html-webpack-plugin/commit/86245db670a9b3bdd0e2aba9f2031745a98434c7), [50b3bec](https://github.com/jantimon/html-webpack-plugin/commit/50b3bec51a43289d6d1b4e1e6439560eb791576f), [c697725](https://github.com/jantimon/html-webpack-plugin/commit/c697725e9f4dd990bd4b7927bbfa7b826d2f36f2)) +* allow generating one file per chunk with the new `'[name]'` placeholder for the `filename` option ([cd5bd2a](https://github.com/jantimon/html-webpack-plugin/commit/cd5bd2afc902bbe5a5ceec4756ef634a26aa1332), [3d9ff48](https://github.com/jantimon/html-webpack-plugin/commit/3d9ff48543d04d9f7c3440bfefb43751775a9e81)) +* the `filename` option can now be a function ([c5beb4b](https://github.com/jantimon/html-webpack-plugin/commit/c5beb4bd16e4916b5355c300abebf9d7d3c587da)) +* add support for `'auto'` public paths inside templates ([a059fcf](https://github.com/jantimon/html-webpack-plugin/commit/a059fcf32d94aaaa738359cedce0b0e4af68f0de), [b09b439](https://github.com/jantimon/html-webpack-plugin/commit/b09b439f50ecb75994acde2eb2967ad690ff1cf0)) +* use defer as default script loading mechanism ([35b6b87](https://github.com/jantimon/html-webpack-plugin/commit/35b6b878db17f0f5704a187b336a14fdd58cedfc)) +* allow to set publicPath to an empty string `''` ([5ea7de4](https://github.com/jantimon/html-webpack-plugin/commit/5ea7de4ba271813835be700316c8a1763b205d2d)) +* improve typings ([197ddd8](https://github.com/jantimon/html-webpack-plugin/commit/197ddd88f39a2e6e70863b6fed2385d33043d137)) +* provide public path to the alterAssetTagGroups hook ([1b54dfb](https://github.com/jantimon/html-webpack-plugin/commit/1b54dfbd62c0d0df10dd3d2be9937626142d518f)) +* provide public path to the alterAssetTags hook ([b754626](https://github.com/jantimon/html-webpack-plugin/commit/b75462653d11803a428b1d29479e259c3010163f)) +* use `thisCompilation` in child compiler for faster builds ([1d59e9a](https://github.com/jantimon/html-webpack-plugin/commit/1d59e9a71ddba1429168c42569a7bd9bdd363f4f)) +* export new major in static property ([8b692bd](https://github.com/jantimon/html-webpack-plugin/commit/8b692bd7cc0b75ddf55f47da317eed9bd19dab91)) +* reduce dependencies ([8c28aaa](https://github.com/jantimon/html-webpack-plugin/commit/8c28aaa2bed5a7147b397fef3801cfe8fb5c34b9), [56e633f](https://github.com/jantimon/html-webpack-plugin/commit/56e633fcb90909c2bbedbd63590ecaa825d8b31f)) + + +### Bug Fixes + +* emit files on every build to work properly with plugins like the +clean-webpack-plugin ([6b3d087](https://github.com/jantimon/html-webpack-plugin/commit/6b3d087cf17f63b596c298d70a42a7462dd0f881)) +* generate html files even if no webpack entry exists ([2693dfa](https://github.com/jantimon/html-webpack-plugin/commit/2693dfaf4c94625eab86afadfd0e4d8822092d6b)) +* keep binary format when adding assets ([7e2b208](https://github.com/jantimon/html-webpack-plugin/commit/7e2b208634e26299c509e0c6b3189e01e4c3d3df)), closes [#1537](https://github.com/jantimon/html-webpack-plugin/issues/1537) + +### [4.5.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.5.0...v4.5.1) (2021-01-03) + + +### Bug Fixes + +* inject javascripts in the tag for inject:true and scriptLoading:'defer' ([4f7064e](https://github.com/jantimon/html-webpack-plugin/commit/4f7064ee56fe710e8f416018956647a72c270fb1)) + +# [4.5.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.4.1...v4.5.0) (2020-09-21) + + +### Features + +* Add publicPath option to overrule the default path generation ([#1516](https://github.com/jantimon/html-webpack-plugin/issues/1516)) ([19b5122](https://github.com/jantimon/html-webpack-plugin/commit/19b5122)) +* update webpack dependency range to allow installing webpack 5 beta ([f3ccdd5](https://github.com/jantimon/html-webpack-plugin/commit/f3ccdd5)), closes [#1504](https://github.com/jantimon/html-webpack-plugin/issues/1504) + + + +## [4.4.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.4.0...v4.4.1) (2020-08-30) + + +### Bug Fixes + +* broken typings.d.ts in v4.4.0 ([#1503](https://github.com/jantimon/html-webpack-plugin/issues/1503)) ([98ad756](https://github.com/jantimon/html-webpack-plugin/commit/98ad756)) + + + +# [4.4.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.3.0...v4.4.0) (2020-08-30) + + +### Bug Fixes + +* fix typos in comments ([#1484](https://github.com/jantimon/html-webpack-plugin/issues/1484)) ([6b0711e](https://github.com/jantimon/html-webpack-plugin/commit/6b0711e)) + + +### Features + +* added v5 compilation support and deleted depreciation warnings ([4ae7be8](https://github.com/jantimon/html-webpack-plugin/commit/4ae7be8)), closes [#1454](https://github.com/jantimon/html-webpack-plugin/issues/1454) + + + +# [4.3.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.2.2...v4.3.0) (2020-04-30) + + +### Features + +* Allow to use console.log inside templates ([c3f2fdc](https://github.com/jantimon/html-webpack-plugin/commit/c3f2fdc)) + + + +## [4.2.2](https://github.com/jantimon/html-webpack-plugin/compare/v4.2.1...v4.2.2) (2020-04-30) + + +### Bug Fixes + +* Prevent "cannot read property info of undefined" when reading meta information from assets ([253ce30](https://github.com/jantimon/html-webpack-plugin/commit/253ce30)) +* use modern icon tag rel attribute for favicons ([c40dd85](https://github.com/jantimon/html-webpack-plugin/commit/c40dd85)) + + + +## [4.2.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.2.0...v4.2.1) (2020-04-28) + + +### Bug Fixes + +* don't add dependencies twice to the webpack 5 watcher api ([ceafe14](https://github.com/jantimon/html-webpack-plugin/commit/ceafe143650749a5f53a14411dc1b762e252ec44)) +* prevent scripts marked as hotModuleReplacement from being added to the html file ([119252a](https://github.com/jantimon/html-webpack-plugin/commit/119252a381bf43dea37c1be64f90c10bebc21302)) + + + +# [4.2.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.1.0...v4.2.0) (2020-04-09) + + +### Features + +* Add template content ([#1401](https://github.com/jantimon/html-webpack-plugin/issues/1401)) ([4740bf7](https://github.com/jantimon/html-webpack-plugin/commit/4740bf7)) + + + +# [4.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.4...v4.1.0) (2020-04-09) + + +### Features + +* Add webpack 5 support ([39c38a4](https://github.com/jantimon/html-webpack-plugin/commit/39c38a4)) +* Allow webpack 5 as peer dependency ([9c571e2](https://github.com/jantimon/html-webpack-plugin/commit/9c571e2)) + + + +## [4.0.4](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.3...v4.0.4) (2020-04-01) + + +### Bug Fixes + +* Fix querystring encoding ([#1386](https://github.com/jantimon/html-webpack-plugin/issues/1386)) ([4f48a39](https://github.com/jantimon/html-webpack-plugin/commit/4f48a39e5738a5d431be2bec39c1b1f0de800d57)), closes [#1355](https://github.com/jantimon/html-webpack-plugin/issues/1355) + + + +## [4.0.3](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.2...v4.0.3) (2020-03-28) + + +### Bug Fixes + +* add webpack, tapable and html-minifier-terser as dependencies because of types.d.ts ([238da81](https://github.com/jantimon/html-webpack-plugin/commit/238da8123950f87267954fd448f3e6b0fb1ead17)) + + + +## [4.0.2](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.1...v4.0.2) (2020-03-26) + + +### Bug Fixes + +* don't remove trailing slashes from self closing tags by default ([2281e4b](https://github.com/jantimon/html-webpack-plugin/commit/2281e4bfda9b91c4a83d63bfc8df8372d1e6ae9e)) + + + +## [4.0.1](https://github.com/jantimon/html-webpack-plugin/compare/v4.0.0...v4.0.1) (2020-03-23) + + +### Bug Fixes + +* update typedefs to match with html-minifier-terser ([2698c7e](https://github.com/jantimon/html-webpack-plugin/commit/2698c7e45a7f12113a07b256dc400ec89666130d)) + + + +# [4.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v3.2.0...v4.0.0) (2020-03-23) + +The summary can be found in the [**release blog post**](https://dev.to/jantimon/html-webpack-plugin-4-has-been-released-125d). + +### Bug Fixes + +* Add dependencies from the child compilation to the main compilation ([27c3e72](https://github.com/jantimon/html-webpack-plugin/commit/27c3e727b073701bfc739859d8325435d27cbf35)) +* Add typing for assets(Close jantimon[#1243](https://github.com/jantimon/html-webpack-plugin/issues/1243)) ([9fef060](https://github.com/jantimon/html-webpack-plugin/commit/9fef0603eb532b3e6a1e8871b4568e62f9bba1a3)) +* allow `contenthash` along with `templatehash` ([049d4d3](https://github.com/jantimon/html-webpack-plugin/commit/049d4d3436092b8beff3f5745e77b20f1c168c4c)), closes [#1033](https://github.com/jantimon/html-webpack-plugin/issues/1033) +* Catch and ignore pretty-error errors ([2056139](https://github.com/jantimon/html-webpack-plugin/commit/2056139a9533ff9487506531491c0e5a94003607)), closes [#921](https://github.com/jantimon/html-webpack-plugin/issues/921) +* Drop @types/webpack dependency ([d4eb1c7](https://github.com/jantimon/html-webpack-plugin/commit/d4eb1c749316af3964126606fe6c70a233c30fef)) +* Ignore foreign child compilers ([1422664](https://github.com/jantimon/html-webpack-plugin/commit/14226649aa1bbaf7b174bcacafdbe47d8ba6c851)) +* Improve perfomance for appcache files ([b94e043](https://github.com/jantimon/html-webpack-plugin/commit/b94e0434f5dbb06ee2179e91ebaa2ce7801937e0)) +* load script files before style files files in defer script loading mode ([97f9fb9](https://github.com/jantimon/html-webpack-plugin/commit/97f9fb9a68e4d3c3c9453296c352e831f7546937)) +* Prevent chunks from beeing added multiple times ([d65b37d](https://github.com/jantimon/html-webpack-plugin/commit/d65b37d2c588047e0d81a38f4645fcdb3ead0b9e)) +* Prevent lodash from being inlined to work around a babel-loader incompatibility ([7f21910](https://github.com/jantimon/html-webpack-plugin/commit/7f21910707a2b53a9a5da3ac9e4b01e36147402f)), closes [#1223](https://github.com/jantimon/html-webpack-plugin/issues/1223) +* Remove compilation.getStats() call for performance reasons ([7005a55](https://github.com/jantimon/html-webpack-plugin/commit/7005a557529bee948c5ef0a1b8b44a1a41a28417)) +* remove useless links for options ([#1153](https://github.com/jantimon/html-webpack-plugin/issues/1153)) ([267e0e0](https://github.com/jantimon/html-webpack-plugin/commit/267e0e0eac155569c822c34f120490bdf3f56d43)) +* Update references to html-minifier ([24bf1b5](https://github.com/jantimon/html-webpack-plugin/commit/24bf1b5e2a0d087b30d057d1780d8f495aa01e26)), closes [#1311](https://github.com/jantimon/html-webpack-plugin/issues/1311) +* **typings.d.ts:** added apply method type to HtmlWwbpackPlugin class definitoin ([8b7255f](https://github.com/jantimon/html-webpack-plugin/commit/8b7255f555423dd1bfa51a3c28700e4bd116f97b)), closes [jantimon#1244](https://github.com/jantimon/issues/1244) +* rename `contenthash` to `templatehash` ([4c11c5d](https://github.com/jantimon/html-webpack-plugin/commit/4c11c5dfde9d87d71dce9cf51864648f8e42b912)) +* Repair typings ([#1166](https://github.com/jantimon/html-webpack-plugin/issues/1166)) ([f4cb241](https://github.com/jantimon/html-webpack-plugin/commit/f4cb241157a9a1fed4721b1abc1f390b09595494)) +* small type. minifcation instead of minification ([#1154](https://github.com/jantimon/html-webpack-plugin/issues/1154)) ([56037a6](https://github.com/jantimon/html-webpack-plugin/commit/56037a6b2ae4a7606b54f5af213b6a2b8145f95e)) +* Use src/index.ejs by default if present ([#1167](https://github.com/jantimon/html-webpack-plugin/issues/1167)) ([c27e5e4](https://github.com/jantimon/html-webpack-plugin/commit/c27e5e46a334d9c1e177a521ea7c9a5ba3c6d980)) +* **chunksorter:** Don't sort chunks by default ([22fb03f](https://github.com/jantimon/html-webpack-plugin/commit/22fb03fb17fdb37d5ce6de00af154b5575a02d3a)) +* **loader:** switch to loaderUtils.getOptions ([a0a0f0d](https://github.com/jantimon/html-webpack-plugin/commit/a0a0f0dc755fbc3249aa2e1d1c6a4dd307ab8e8a)) +* **README:** adds a link to template option documentation ([f40aeae](https://github.com/jantimon/html-webpack-plugin/commit/f40aeae312af73c6c5263cd99e81069f41d3b699)) +* **tests:** Upgrade webpack-recompilation-simulator ([dfe1d10](https://github.com/jantimon/html-webpack-plugin/commit/dfe1d10c4511b0da4354cacf79ca0d5ac7baf862)) +* Update lodash to 4.17.10 ([cc3bf49](https://github.com/jantimon/html-webpack-plugin/commit/cc3bf4909605879993c22e3048ee520dbdc8fa49)) + + +### Code Refactoring + +* Change the structure of the internal assets object ([37db086](https://github.com/jantimon/html-webpack-plugin/commit/37db0868efdbf334a1b60003fe5bd376cfd8ae01)) +* Changed hook names and arguments - the hook order is 'beforeAssetTagGeneration', 'alterAssetTags', 'alterAssetTagGroups', 'afterTemplateExecution', 'beforeEmit', 'afterEmit' ([14b4456](https://github.com/jantimon/html-webpack-plugin/commit/14b4456ba67a5b85421b558bbd5f1d59c7b410b3)) +* Use Webpack 4 APIs ([47efdea](https://github.com/jantimon/html-webpack-plugin/commit/47efdeaf17806f7d4e26aefacc748a92077f904a)) + + +### Features + +* add `.toString` implementation to htmlTags to allow easier rendering ([34d8aa5](https://github.com/jantimon/html-webpack-plugin/commit/34d8aa572c7acc59c26f3b5d15bf489a07aa4c24)) +* Add default viewport meta tag for default template ([302e39e](https://github.com/jantimon/html-webpack-plugin/commit/302e39e30013b5828bb6c9e7036db951f70d0cf5)), closes [#897](https://github.com/jantimon/html-webpack-plugin/issues/897) [#978](https://github.com/jantimon/html-webpack-plugin/issues/978) +* Add defer script loading ([de315eb](https://github.com/jantimon/html-webpack-plugin/commit/de315eb98497f3e5f517d59dbbe120b48c9b8db9)) +* Add support for relative publicPath ([dbbdd81](https://github.com/jantimon/html-webpack-plugin/commit/dbbdd81de570dd181ea0905a6445fdeb5a784912)) +* Add support for tag ([#1160](https://github.com/jantimon/html-webpack-plugin/issues/1160)) ([c5d4b86](https://github.com/jantimon/html-webpack-plugin/commit/c5d4b869c196c59cdd6a9c30db58f1f8be07a820)) +* Add support for minifying inline ES6 inside html templates ([c66766c](https://github.com/jantimon/html-webpack-plugin/commit/c66766cdae3593091dee413b9c585359c24ef068)), closes [#1262](https://github.com/jantimon/html-webpack-plugin/issues/1262) +* Add support for the [contenthash] placeholder inside htm file names ([ae8233a](https://github.com/jantimon/html-webpack-plugin/commit/ae8233a04d4105b6e970feaa2c5e11c0b48fd4b7)) +* Add typings to package.json ([a524e8f](https://github.com/jantimon/html-webpack-plugin/commit/a524e8f24e905d5e51fedd50d33a41328a9b87eb)), closes [#1132](https://github.com/jantimon/html-webpack-plugin/issues/1132) +* Allow to return async template parameters ([99f9362](https://github.com/jantimon/html-webpack-plugin/commit/99f9362703055baf0029b8852cb5339b6218829d)) +* drop workaround for "Uncaught TypeError: __webpack_require__(...) is not a function" to be compatible with webpack 5 ([15ad0d2](https://github.com/jantimon/html-webpack-plugin/commit/15ad0d260443edfdcc953fa08c675c90c063bac7)) +* Export major version of this plugin ([6ae6f48](https://github.com/jantimon/html-webpack-plugin/commit/6ae6f48ecf92b080809d68092ee8c6825edfe5a4)) +* merge templateParameters with default template parameters ([1d66e53](https://github.com/jantimon/html-webpack-plugin/commit/1d66e5333bc2aeb8caadf96e572af756d3708d19)) +* Provide a verbose error message if html minification failed ([7df269f](https://github.com/jantimon/html-webpack-plugin/commit/7df269fd2a840d0800cb259bd559edb0b766e7ab)) +* **compiler:** Add file dependencies ([bbc07a3](https://github.com/jantimon/html-webpack-plugin/commit/bbc07a3a214e3b693e6c9e3d6404e146a0fc023a)) +* **compiler:** Use a single compiler for multiple plugin instances ([f29ae88](https://github.com/jantimon/html-webpack-plugin/commit/f29ae886d7fad50e7fbb78ac7ff7d5bd9bc47f49)) +* **compiler:** Use timestamps to verify cache validity ([0ebcd17](https://github.com/jantimon/html-webpack-plugin/commit/0ebcd1776132262b799f2814659f4d90c3f3c1b3)) +* Remove selfClosingTag ([5d3d8e4](https://github.com/jantimon/html-webpack-plugin/commit/5d3d8e4b73b7b97dba8bdf5fe1ecf50598040b54)) +* Remove type="text/javascript" from injected script tags ([b46bf67](https://github.com/jantimon/html-webpack-plugin/commit/b46bf67ae4492a12b60c42c7d26831e480522b49)) +* Replace jade with pug in examples ([d7ec407](https://github.com/jantimon/html-webpack-plugin/commit/d7ec4078c85b3ed9c2ff84e10fe75392f26a6130)) +* Switch from jasmine to jest ([ae1f435](https://github.com/jantimon/html-webpack-plugin/commit/ae1f43527945c8ae953c2ba549631f2d090e003a)) +* **hooks:** Add a helper for easier hook access ([b6dec4b](https://github.com/jantimon/html-webpack-plugin/commit/b6dec4bf1072509282756e8d83ef6ee447485f3a)) +* **hooks:** Provide static getHook method for access to all html-webpack-plugin hooks ([#995](https://github.com/jantimon/html-webpack-plugin/issues/995)) ([82b34a1](https://github.com/jantimon/html-webpack-plugin/commit/82b34a1dd2e96cbcd715fafe4e97073efd30cc9f)) +* Simplify element and charset attribute ([55313be](https://github.com/jantimon/html-webpack-plugin/commit/55313bee9b82ea79157085e48bba4fa2ebfef6a4)) +* support ES6 template string in default loader ([d6b65dd](https://github.com/jantimon/html-webpack-plugin/commit/d6b65dd1531038deac1be87c2087da5955903d24)), closes [#950](https://github.com/jantimon/html-webpack-plugin/issues/950) +* Use jsdoc for static typing ([a6b8d2d](https://github.com/jantimon/html-webpack-plugin/commit/a6b8d2dcf3b1183d50589b869162b972ad32de4d)) +* Use webpack 4 entries api to extract asset information ([342867e](https://github.com/jantimon/html-webpack-plugin/commit/342867e1edb7c2a8748b0aca396f160f0b13d42e)) +* **html-tags:** Add a helper to create html-tags ([ee6a165](https://github.com/jantimon/html-webpack-plugin/commit/ee6a165425a6b47dff341fb651848ec5727d7f7e)) + + +### BREAKING CHANGES + +* **defaults:** Use src/index.ejs if no template option is set. +* **defaults:** The default template has now a predefined viewport meta tag +* **defaults:** The default meta utf-8 declaration was changed to +* **hooks:** Renamed beforeHtmlGeneration hook to beforeAssetTagGeneration +* **hooks:** Renamed beforeHtmlProcessing hook to alterAssetTags +* **hooks:** Renamed afterHtmlProcessing hook to beforeEmit +* **hooks:** The html-webpack-plugin doesn't add its hooks to the compilation object anymore +* The assets object which is used for the template parameters and inside hooks was changed. The chunks property was removed and the js and css property was converted from a string into an object `{ entryName: string, path: string}` +* The mimetype information "text/javascript" is removed from all generated script +tags +* Remove selfClosingTag attribute +* Template strings inside templates are now disabled by default +* Dropped support for Webpack 1 - 3 +* Template variable webpack was removed +* **chunksorter:** Chunks aren't sorted anymore by default + + + +# [3.2.0](https://github.com/jantimon/html-webpack-plugin/compare/v3.1.0...v3.2.0) (2018-04-03) + + +### Bug Fixes + +* **loader:** Allow to add new template parameters ([f7eac19](https://github.com/jantimon/html-webpack-plugin/commit/f7eac19)), closes [#915](https://github.com/jantimon/html-webpack-plugin/issues/915) +* **loader:** Use lodash inside the loader directly ([7b4eb7f](https://github.com/jantimon/html-webpack-plugin/commit/7b4eb7f)), closes [#786](https://github.com/jantimon/html-webpack-plugin/issues/786) + + +### Features + +* Add meta tag option ([a7d37ca](https://github.com/jantimon/html-webpack-plugin/commit/a7d37ca)) +* Support node 6.9 ([74a22c4](https://github.com/jantimon/html-webpack-plugin/commit/74a22c4)), closes [#918](https://github.com/jantimon/html-webpack-plugin/issues/918) + + + + +# [3.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.8...v3.1.0) (2018-03-22) + + +### Features + +* Allow to overwrite the templateParameter [#830](https://github.com/jantimon/html-webpack-plugin/issues/830) ([c5e32d3](https://github.com/jantimon/html-webpack-plugin/commit/c5e32d3)) + + + + +## [3.0.8](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.7...v3.0.8) (2018-03-22) + + +### Bug Fixes + +* **compiler:** Fallback to 3.0.7 because of [#900](https://github.com/jantimon/html-webpack-plugin/issues/900) ([05ee29b](https://github.com/jantimon/html-webpack-plugin/commit/05ee29b)) + + + + +## [3.0.7](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.6...v3.0.7) (2018-03-19) + + +### Bug Fixes + +* **compiler:** Set single entry name [#895](https://github.com/jantimon/html-webpack-plugin/issues/895) ([26dcb98](https://github.com/jantimon/html-webpack-plugin/commit/26dcb98)) + + + + +## [3.0.6](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.5...v3.0.6) (2018-03-06) + + +### Bug Fixes + +* **hooks:** Call tapable.apply directly [#879](https://github.com/jantimon/html-webpack-plugin/issues/879) ([bcbb036](https://github.com/jantimon/html-webpack-plugin/commit/bcbb036)) + + + + +## [3.0.5](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.2...v3.0.5) (2018-03-06) + + +### Bug Fixes + +* **entries:** do not ignore JS if there is also CSS ([020b714](https://github.com/jantimon/html-webpack-plugin/commit/020b714)) +* **entries:** Don't add css entries twice ([0348d6b](https://github.com/jantimon/html-webpack-plugin/commit/0348d6b)) +* **hooks:** Remove deprecated tapable calls [#879](https://github.com/jantimon/html-webpack-plugin/issues/879) ([2288f20](https://github.com/jantimon/html-webpack-plugin/commit/2288f20)) + + + + +## [3.0.4](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.2...v3.0.4) (2018-03-01) + + +### Bug Fixes + +* **entries:** Don't add css entries twice ([e890f23](https://github.com/jantimon/html-webpack-plugin/commit/e890f23)) + + + + +## [3.0.3](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.2...v3.0.3) (2018-03-01) + + +### Refactor + +* **performance:** Reduce the amount of chunk information gathered based on #825 ([06c59a7](https://github.com/jantimon/html-webpack-plugin/commit/06c59a7)) + + + +## [3.0.2](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.1...v3.0.2) (2018-03-01) + + +### Bug Fixes + +* **query-loader:** In case no query is provided, return an empty object. This fixes #727 ([7587754](https://github.com/jantimon/html-webpack-plugin/commit/7587754)) + + + + +## [3.0.1](https://github.com/jantimon/html-webpack-plugin/compare/v3.0.0...v3.0.1) (2018-03-01) + + +### Bug Fixes + +* **package:** Remove the extract-text-webpack-plugin peer dependency ([57411a9](https://github.com/jantimon/html-webpack-plugin/commit/57411a9)) + + +## [3.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v2.30.1...v3.0.0) (2018-28-02) + +### Features + +* Add support for the new [webpack tapable](https://github.com/webpack/tapable) to be compatible with webpack 4.x +* Remove bluebird dependency + +### BREAKING CHANGES + +* Similar to webpack 4.x the support for node versions older than 6 are no longer supported + + +## 2.30.1 + +* Revert part the performance optimization ([#723](https://github.com/jantimon/html-webpack-plugin/pull/723)) because of [#753](https://github.com/jantimon/html-webpack-plugin/issues/753). + + +## 2.30.0 -v2.30.0 ---- * Add manual sort -* Performance improvements (#723) +* Performance improvements ([#723](https://github.com/jantimon/html-webpack-plugin/pull/723)) + + +## 2.29.0 -v2.29.0 ---- * Add support for Webpack 3 -v2.28.0 ---- + +## 2.28.0 + * Backport 3.x void tag for plugin authors -v2.27.1 ---- + +## 2.27.1 + * Revert 2.25.0 loader resolving -v2.27.0 ---- -* Fix a chunksorter webpack 2 issue (#569) -* Fix template path resolving(#542) + +## 2.27.0 + +* Fix a chunksorter webpack 2 issue ([#569](https://github.com/jantimon/html-webpack-plugin/pull/569)) +* Fix template path resolving ([#542](https://github.com/jantimon/html-webpack-plugin/pull/542)) + + +## 2.26.0 -v2.26.0 ---- * Allow plugins to add attributes without values to the ` - ``` -If you have multiple webpack entry points, they will all be included with `script` -tags in the generated HTML. +If you have multiple `webpack` entry points, they will all be included with `script` tags in the generated HTML. -If you have any CSS assets in webpack's output (for example, CSS extracted -with the [ExtractTextPlugin](https://github.com/webpack/extract-text-webpack-plugin)) +If you have any CSS assets in webpack's output (for example, CSS extracted with the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin)) then these will be included with `` tags in the HTML head. -Configuration -------------- -You can pass a hash of configuration options to `HtmlWebpackPlugin`. +If you have plugins that make use of it, `html-webpack-plugin` should be ordered first before any of the integrated Plugins. + +

Options

+ +You can pass a hash of configuration options to `html-webpack-plugin`. Allowed values are as follows: -- `title`: The title to use for the generated HTML document. -- `filename`: The file to write the HTML to. Defaults to `index.html`. - You can specify a subdirectory here too (eg: `assets/admin.html`). -- `template`: Webpack require path to the template. Please see the [docs](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md) for details. -- `inject`: `true | 'head' | 'body' | false` Inject all assets into the given `template` or `templateContent` - When passing `true` or `'body'` all javascript resources will be placed at the bottom of the body element. `'head'` will place the scripts in the head element. -- `favicon`: Adds the given favicon path to the output html. -- `minify`: `{...} | false` Pass [html-minifier](https://github.com/kangax/html-minifier#options-quick-reference)'s options as object to minify the output. -- `hash`: `true | false` if `true` then append a unique webpack compilation hash to all - included scripts and CSS files. This is useful for cache busting. -- `cache`: `true | false` if `true` (default) try to emit the file only if it was changed. -- `showErrors`: `true | false` if `true` (default) errors details will be written into the HTML page. -- `chunks`: Allows you to add only some chunks (e.g. only the unit-test chunk) -- `chunksSortMode`: Allows to control how chunks should be sorted before they are included to the html. Allowed values: 'none' | 'auto' | 'dependency' |'manual' | {function} - default: 'auto' -- `excludeChunks`: Allows you to skip some chunks (e.g. don't add the unit-test chunk) -- `xhtml`: `true | false` If `true` render the `link` tags as self-closing, XHTML compliant. Default is `false` - -Here's an example webpack config illustrating how to use these options: -```javascript +|Name|Type|Default|Description| +|:--:|:--:|:-----:|:----------| +|**`title`**|`{String}`|`Webpack App`|The title to use for the generated HTML document| +|**`filename`**|`{String\|Function}`|`'index.html'`|The file to write the HTML to. Defaults to `index.html`. You can specify a subdirectory here too (eg: `assets/admin.html`). The `[name]` placeholder will be replaced with the entry name. Can also be a function e.g. `(entryName) => entryName + '.html'`. | +|**`template`**|`{String}`|``|`webpack` relative or absolute path to the template. By default it will use `src/index.ejs` if it exists. Please see the [docs](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md) for details| +|**`templateContent`**|`{string\|Function\|false}`|false| Can be used instead of `template` to provide an inline template - please read the [Writing Your Own Templates](https://github.com/jantimon/html-webpack-plugin#writing-your-own-templates) section | +|**`templateParameters`**|`{Boolean\|Object\|Function}`| `false`| Allows to overwrite the parameters used in the template - see [example](https://github.com/jantimon/html-webpack-plugin/tree/master/examples/template-parameters) | +|**`inject`**|`{Boolean\|String}`|`true`|`true \|\| 'head' \|\| 'body' \|\| false` Inject all assets into the given `template` or `templateContent`. When passing `'body'` all javascript resources will be placed at the bottom of the body element. `'head'` will place the scripts in the head element. Passing `true` will add it to the head/body depending on the `scriptLoading` option. Passing `false` will disable automatic injections. - see the [inject:false example](https://github.com/jantimon/html-webpack-plugin/tree/master/examples/custom-insertion-position)| +|**`publicPath`**|`{String\|'auto'}`|`'auto'`|The publicPath used for script and link tags| +|**`scriptLoading`**|`{'blocking'\|'defer'\|'module'}`|`'defer'`| Modern browsers support non blocking javascript loading (`'defer'`) to improve the page startup performance. Setting to `'module'` adds attribute [`type="module"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#applying_the_module_to_your_html). This also implies "defer", since modules are automatically deferred. | +|**`favicon`**|`{String}`|``|Adds the given favicon path to the output HTML| +|**`meta`**|`{Object}`|`{}`|Allows to inject `meta`-tags. E.g. `meta: {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}`| +|**`base`**|`{Object\|String\|false}`|`false`|Inject a [`base`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) tag. E.g. `base: "https://example.com/path/page.html`| +|**`minify`**|`{Boolean\|Object}`|`true` if `mode` is `'production'`, otherwise `false`|Controls if and in what ways the output should be minified. See [minification](#minification) below for more details.| +|**`hash`**|`{Boolean}`|`false`|If `true` then append a unique `webpack` compilation hash to all included scripts and CSS files. This is useful for cache busting| +|**`cache`**|`{Boolean}`|`true`|Emit the file only if it was changed| +|**`showErrors`**|`{Boolean}`|`true`|Errors details will be written into the HTML page| +|**`chunks`**|`{?}`|`?`|Allows you to add only some chunks (e.g only the unit-test chunk)| +|**`chunksSortMode`**|`{String\|Function}`|`auto`|Allows to control how chunks should be sorted before they are included to the HTML. Allowed values are `'none' \| 'auto' \| 'manual' \| {Function}`| +|**`excludeChunks`**|`{Array.}`|``|Allows you to skip some chunks (e.g don't add the unit-test chunk)| +|**`xhtml`**|`{Boolean}`|`false`|If `true` render the `link` tags as self-closing (XHTML compliant)| + +Here's an example webpack config illustrating how to use these options + +**webpack.config.js** +```js { entry: 'index.js', output: { @@ -116,18 +181,13 @@ Here's an example webpack config illustrating how to use these options: } ``` -FAQ ----- +### Generating Multiple HTML Files -* [Why is my HTML minified?](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md) -* [Why is my `<% ... %>` template not working?](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md) -* [How can I use handlebars/pug/ejs as template engine](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md) - -Generating Multiple HTML Files ------------------------------- To generate more than one HTML file, declare the plugin more than -once in your plugins array: -```javascript +once in your plugins array + +**webpack.config.js** +```js { entry: 'index.js', output: { @@ -144,29 +204,31 @@ once in your plugins array: } ``` -Writing Your Own Templates --------------------------- +### Writing Your Own Templates + If the default generated HTML doesn't meet your needs you can supply your own template. The easiest way is to use the `template` option and pass a custom HTML file. The html-webpack-plugin will automatically inject all necessary CSS, JS, manifest and favicon files into the markup. -```javascript +Details of other template loaders are [documented here](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md). + +```js plugins: [ new HtmlWebpackPlugin({ title: 'Custom template', - template: 'my-index.ejs', // Load a custom template (ejs by default see the FAQ for details) + // Load a custom template (lodash by default) + template: 'index.html' }) ] ``` -`my-index.ejs`: - +**index.html** ```html - + <%= htmlWebpackPlugin.options.title %> @@ -175,70 +237,109 @@ plugins: [ ``` If you already have a template loader, you can use it to parse the template. -Please note that this will also happen if you specifiy the html-loader and use `.html` file as template. +Please note that this will also happen if you specify the html-loader and use `.html` file as template. -```javascript +**webpack.config.js** +```js module: { loaders: [ - { test: /\.hbs$/, loader: "handlebars" } + { test: /\.hbs$/, loader: "handlebars-loader" } ] }, plugins: [ new HtmlWebpackPlugin({ title: 'Custom template using Handlebars', - template: 'my-index.hbs' + template: 'index.hbs' }) ] ``` -You can use the lodash syntax out of the box. -If the `inject` feature doesn't fit your needs and you want full control over the asset placement use the [default template](https://github.com/jaketrent/html-webpack-template/blob/86f285d5c790a6c15263f5cc50fd666d51f974fd/index.html) of the [html-webpack-template project](https://github.com/jaketrent/html-webpack-template) as a starting point for writing your own. +You can use the `lodash` syntax out of the box. If the `inject` feature doesn't fit your needs and you want full control over the asset placement use the [default template](https://github.com/jaketrent/html-webpack-template/blob/86f285d5c790a6c15263f5cc50fd666d51f974fd/index.html) of the [html-webpack-template project](https://github.com/jaketrent/html-webpack-template) as a starting point for writing your own. + +The following variables are available in the template by default (you can extend them using the `templateParameters` option): -The following variables are available in the template: - `htmlWebpackPlugin`: data specific to this plugin - - `htmlWebpackPlugin.files`: a massaged representation of the - `assetsByChunkName` attribute of webpack's [stats](https://github.com/webpack/docs/wiki/node.js-api#stats) - object. It contains a mapping from entry point name to the bundle filename, eg: - ```json - "htmlWebpackPlugin": { - "files": { - "css": [ "main.css" ], - "js": [ "assets/head_bundle.js", "assets/main_bundle.js"], - "chunks": { - "head": { - "entry": "assets/head_bundle.js", - "css": [ "main.css" ] - }, - "main": { - "entry": "assets/main_bundle.js", - "css": [] - }, - } - } - } - ``` - If you've set a publicPath in your webpack config this will be reflected - correctly in this assets hash. - `htmlWebpackPlugin.options`: the options hash that was passed to the plugin. In addition to the options actually used by this plugin, you can use this hash to pass arbitrary data through to your template. -- `webpack`: the webpack [stats](https://github.com/webpack/docs/wiki/node.js-api#stats) - object. Note that this is the stats object as it was at the time the HTML template - was emitted and as such may not have the full set of stats that are available - after the webpack run is complete. + - `htmlWebpackPlugin.tags`: the prepared `headTags` and `bodyTags` Array to render the ``, ``, ` \ No newline at end of file diff --git a/examples/appcache/dist/webpack-1/manifest.appcache b/examples/appcache/dist/webpack-1/manifest.appcache deleted file mode 100644 index 95445d58..00000000 --- a/examples/appcache/dist/webpack-1/manifest.appcache +++ /dev/null @@ -1,9 +0,0 @@ -CACHE MANIFEST -# f688cbdde5a6e721015e - -0714810ae3fb211173e2964249507195.png -bundle.js -styles.css - -NETWORK: -* diff --git a/examples/appcache/dist/webpack-2/bundle.js b/examples/appcache/dist/webpack-2/bundle.js deleted file mode 100644 index 0d7adbe8..00000000 --- a/examples/appcache/dist/webpack-2/bundle.js +++ /dev/null @@ -1,86 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -__webpack_require__(0); -var h1 = document.createElement('h1'); -h1.innerHTML = 'Hello world!'; -document.body.appendChild(h1); - - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/appcache/dist/webpack-2/index.html b/examples/appcache/dist/webpack-2/index.html deleted file mode 100644 index 536e8a47..00000000 --- a/examples/appcache/dist/webpack-2/index.html +++ /dev/null @@ -1 +0,0 @@ -Example template \ No newline at end of file diff --git a/examples/appcache/dist/webpack-2/manifest.appcache b/examples/appcache/dist/webpack-2/manifest.appcache deleted file mode 100644 index 29e22b40..00000000 --- a/examples/appcache/dist/webpack-2/manifest.appcache +++ /dev/null @@ -1,9 +0,0 @@ -CACHE MANIFEST -# 737de2033617f9f6144d - -0714810ae3fb211173e2964249507195.png -bundle.js -styles.css - -NETWORK: -* diff --git a/examples/appcache/dist/webpack-3/bundle.js b/examples/appcache/dist/webpack-3/bundle.js deleted file mode 100644 index 2d1b6065..00000000 --- a/examples/appcache/dist/webpack-3/bundle.js +++ /dev/null @@ -1,83 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -__webpack_require__(1); -var h1 = document.createElement('h1'); -h1.innerHTML = 'Hello world!'; -document.body.appendChild(h1); - - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/appcache/dist/webpack-3/index.html b/examples/appcache/dist/webpack-3/index.html deleted file mode 100644 index 536e8a47..00000000 --- a/examples/appcache/dist/webpack-3/index.html +++ /dev/null @@ -1 +0,0 @@ -Example template \ No newline at end of file diff --git a/examples/appcache/dist/webpack-3/manifest.appcache b/examples/appcache/dist/webpack-3/manifest.appcache deleted file mode 100644 index 04bdd6db..00000000 --- a/examples/appcache/dist/webpack-3/manifest.appcache +++ /dev/null @@ -1,9 +0,0 @@ -CACHE MANIFEST -# eda37a6c6de5fd0ecfbe - -0714810ae3fb211173e2964249507195.png -bundle.js -styles.css - -NETWORK: -* diff --git a/examples/appcache/webpack.config.js b/examples/appcache/webpack.config.js deleted file mode 100755 index 1ff488e2..00000000 --- a/examples/appcache/webpack.config.js +++ /dev/null @@ -1,34 +0,0 @@ -var path = require('path'); -var AppCachePlugin = require('appcache-webpack-plugin'); -var HtmlWebpackPlugin = require('../..'); -var ExtractTextPlugin = require('extract-text-webpack-plugin'); -var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; - -module.exports = { - context: __dirname, - entry: './example.js', - output: { - path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion), - publicPath: '', - filename: 'bundle.js' - }, - module: { - loaders: [ - { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, - { test: /\.png$/, loader: 'file-loader' }, - { test: /\.html$/, loader: 'html-loader?-removeOptionalTags' } - ] - }, - plugins: [ - new AppCachePlugin(), - new HtmlWebpackPlugin({ - filename: 'index.html', - template: 'template.html', - minify: { - removeComments: true, - collapseWhitespace: true - } - }), - new ExtractTextPlugin('styles.css') - ] -}; diff --git a/examples/build-examples.js b/examples/build-examples.js index adf81ebe..0e45b0bd 100644 --- a/examples/build-examples.js +++ b/examples/build-examples.js @@ -10,17 +10,6 @@ var fs = require('fs'); var path = require('path'); var rimraf = require('rimraf'); var webpack = require('webpack'); -var ExtractTextPlugin = require('extract-text-webpack-plugin'); - -if (Number(webpackMajorVersion) > 1) { - var extractOriginal = ExtractTextPlugin.extract; - ExtractTextPlugin.extract = function (fallback, use) { - return extractOriginal({ - fallback: fallback, - use: use - }); - }; -} var examples = fs.readdirSync(__dirname).filter(function (file) { return fs.statSync(path.join(__dirname, file)).isDirectory(); @@ -30,8 +19,20 @@ examples.forEach(function (exampleName) { var examplePath = path.join(__dirname, exampleName); var configFile = path.join(examplePath, 'webpack.config.js'); + var config = require(configFile); + if (Number(webpackMajorVersion) >= 4) { + config.plugins.unshift(new webpack.LoaderOptionsPlugin({ + options: { + context: process.cwd() // or the same value as `context` + } + })); + config.mode = 'production'; + config.optimization = config.optimization || {}; + config.optimization.minimizer = []; + } + rimraf.sync(path.join(examplePath, 'dist', 'webpack-' + webpackMajorVersion)); - webpack(require(configFile), function (err, stats) { + webpack(config, function (err, stats) { if (err) { console.error(err.stack || err); if (err.details) { diff --git a/examples/chunk-optimization/dist/webpack-5/219.js b/examples/chunk-optimization/dist/webpack-5/219.js new file mode 100644 index 00000000..0c724b7e --- /dev/null +++ b/examples/chunk-optimization/dist/webpack-5/219.js @@ -0,0 +1,352 @@ +(self["webpackChunk"] = self["webpackChunk"] || []).push([[219],{ + +/***/ 609: +/***/ ((module) => { + +"use strict"; + + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +// css base code, injected by the css-loader +// eslint-disable-next-line func-names +module.exports = function (cssWithMappingToString) { + var list = []; // return the list of modules as css string + + list.toString = function toString() { + return this.map(function (item) { + var content = cssWithMappingToString(item); + + if (item[2]) { + return "@media ".concat(item[2], " {").concat(content, "}"); + } + + return content; + }).join(''); + }; // import a list of modules into the list + // eslint-disable-next-line func-names + + + list.i = function (modules, mediaQuery, dedupe) { + if (typeof modules === 'string') { + // eslint-disable-next-line no-param-reassign + modules = [[null, modules, '']]; + } + + var alreadyImportedModules = {}; + + if (dedupe) { + for (var i = 0; i < this.length; i++) { + // eslint-disable-next-line prefer-destructuring + var id = this[i][0]; + + if (id != null) { + alreadyImportedModules[id] = true; + } + } + } + + for (var _i = 0; _i < modules.length; _i++) { + var item = [].concat(modules[_i]); + + if (dedupe && alreadyImportedModules[item[0]]) { + // eslint-disable-next-line no-continue + continue; + } + + if (mediaQuery) { + if (!item[2]) { + item[2] = mediaQuery; + } else { + item[2] = "".concat(mediaQuery, " and ").concat(item[2]); + } + } + + list.push(item); + } + }; + + return list; +}; + +/***/ }), + +/***/ 62: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var isOldIE = function isOldIE() { + var memo; + return function memorize() { + if (typeof memo === 'undefined') { + // Test for IE <= 9 as proposed by Browserhacks + // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 + // Tests for existence of standard globals is to allow style-loader + // to operate correctly into non-standard environments + // @see https://github.com/webpack-contrib/style-loader/issues/177 + memo = Boolean(window && document && document.all && !window.atob); + } + + return memo; + }; +}(); + +var getTarget = function getTarget() { + var memo = {}; + return function memorize(target) { + if (typeof memo[target] === 'undefined') { + var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself + + if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { + try { + // This will throw an exception if access to iframe is blocked + // due to cross-origin restrictions + styleTarget = styleTarget.contentDocument.head; + } catch (e) { + // istanbul ignore next + styleTarget = null; + } + } + + memo[target] = styleTarget; + } + + return memo[target]; + }; +}(); + +var stylesInDom = []; + +function getIndexByIdentifier(identifier) { + var result = -1; + + for (var i = 0; i < stylesInDom.length; i++) { + if (stylesInDom[i].identifier === identifier) { + result = i; + break; + } + } + + return result; +} + +function modulesToDom(list, options) { + var idCountMap = {}; + var identifiers = []; + + for (var i = 0; i < list.length; i++) { + var item = list[i]; + var id = options.base ? item[0] + options.base : item[0]; + var count = idCountMap[id] || 0; + var identifier = "".concat(id, " ").concat(count); + idCountMap[id] = count + 1; + var index = getIndexByIdentifier(identifier); + var obj = { + css: item[1], + media: item[2], + sourceMap: item[3] + }; + + if (index !== -1) { + stylesInDom[index].references++; + stylesInDom[index].updater(obj); + } else { + stylesInDom.push({ + identifier: identifier, + updater: addStyle(obj, options), + references: 1 + }); + } + + identifiers.push(identifier); + } + + return identifiers; +} + +function insertStyleElement(options) { + var style = document.createElement('style'); + var attributes = options.attributes || {}; + + if (typeof attributes.nonce === 'undefined') { + var nonce = true ? __webpack_require__.nc : 0; + + if (nonce) { + attributes.nonce = nonce; + } + } + + Object.keys(attributes).forEach(function (key) { + style.setAttribute(key, attributes[key]); + }); + + if (typeof options.insert === 'function') { + options.insert(style); + } else { + var target = getTarget(options.insert || 'head'); + + if (!target) { + throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); + } + + target.appendChild(style); + } + + return style; +} + +function removeStyleElement(style) { + // istanbul ignore if + if (style.parentNode === null) { + return false; + } + + style.parentNode.removeChild(style); +} +/* istanbul ignore next */ + + +var replaceText = function replaceText() { + var textStore = []; + return function replace(index, replacement) { + textStore[index] = replacement; + return textStore.filter(Boolean).join('\n'); + }; +}(); + +function applyToSingletonTag(style, index, remove, obj) { + var css = remove ? '' : obj.media ? "@media ".concat(obj.media, " {").concat(obj.css, "}") : obj.css; // For old IE + + /* istanbul ignore if */ + + if (style.styleSheet) { + style.styleSheet.cssText = replaceText(index, css); + } else { + var cssNode = document.createTextNode(css); + var childNodes = style.childNodes; + + if (childNodes[index]) { + style.removeChild(childNodes[index]); + } + + if (childNodes.length) { + style.insertBefore(cssNode, childNodes[index]); + } else { + style.appendChild(cssNode); + } + } +} + +function applyToTag(style, options, obj) { + var css = obj.css; + var media = obj.media; + var sourceMap = obj.sourceMap; + + if (media) { + style.setAttribute('media', media); + } else { + style.removeAttribute('media'); + } + + if (sourceMap && typeof btoa !== 'undefined') { + css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); + } // For old IE + + /* istanbul ignore if */ + + + if (style.styleSheet) { + style.styleSheet.cssText = css; + } else { + while (style.firstChild) { + style.removeChild(style.firstChild); + } + + style.appendChild(document.createTextNode(css)); + } +} + +var singleton = null; +var singletonCounter = 0; + +function addStyle(obj, options) { + var style; + var update; + var remove; + + if (options.singleton) { + var styleIndex = singletonCounter++; + style = singleton || (singleton = insertStyleElement(options)); + update = applyToSingletonTag.bind(null, style, styleIndex, false); + remove = applyToSingletonTag.bind(null, style, styleIndex, true); + } else { + style = insertStyleElement(options); + update = applyToTag.bind(null, style, options); + + remove = function remove() { + removeStyleElement(style); + }; + } + + update(obj); + return function updateStyle(newObj) { + if (newObj) { + if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) { + return; + } + + update(obj = newObj); + } else { + remove(); + } + }; +} + +module.exports = function (list, options) { + options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of \ No newline at end of file diff --git a/examples/inline/dist/webpack-1/styles.css b/examples/inline/dist/webpack-1/styles.css deleted file mode 100644 index 232a2cdb..00000000 --- a/examples/inline/dist/webpack-1/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: snow; -} \ No newline at end of file diff --git a/examples/inline/dist/webpack-2/bundle.js b/examples/inline/dist/webpack-2/bundle.js deleted file mode 100644 index 4cd14355..00000000 --- a/examples/inline/dist/webpack-2/bundle.js +++ /dev/null @@ -1,87 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -__webpack_require__(0); - -console.log('Hello World'); - - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/inline/dist/webpack-2/favicon.ico b/examples/inline/dist/webpack-2/favicon.ico deleted file mode 100644 index be74abd6..00000000 Binary files a/examples/inline/dist/webpack-2/favicon.ico and /dev/null differ diff --git a/examples/inline/dist/webpack-2/index.html b/examples/inline/dist/webpack-2/index.html deleted file mode 100644 index aa371731..00000000 --- a/examples/inline/dist/webpack-2/index.html +++ /dev/null @@ -1,89 +0,0 @@ -Jade demo \ No newline at end of file diff --git a/examples/inline/dist/webpack-2/styles.css b/examples/inline/dist/webpack-2/styles.css deleted file mode 100644 index 232a2cdb..00000000 --- a/examples/inline/dist/webpack-2/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: snow; -} \ No newline at end of file diff --git a/examples/inline/dist/webpack-3/bundle.js b/examples/inline/dist/webpack-3/bundle.js deleted file mode 100644 index f719ff9a..00000000 --- a/examples/inline/dist/webpack-3/bundle.js +++ /dev/null @@ -1,84 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -__webpack_require__(1); - -console.log('Hello World'); - - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/inline/dist/webpack-3/favicon.ico b/examples/inline/dist/webpack-3/favicon.ico deleted file mode 100644 index be74abd6..00000000 Binary files a/examples/inline/dist/webpack-3/favicon.ico and /dev/null differ diff --git a/examples/inline/dist/webpack-3/index.html b/examples/inline/dist/webpack-3/index.html deleted file mode 100644 index 97bc04b4..00000000 --- a/examples/inline/dist/webpack-3/index.html +++ /dev/null @@ -1,86 +0,0 @@ -Jade demo \ No newline at end of file diff --git a/examples/inline/dist/webpack-3/styles.css b/examples/inline/dist/webpack-3/styles.css deleted file mode 100644 index 232a2cdb..00000000 --- a/examples/inline/dist/webpack-3/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: snow; -} \ No newline at end of file diff --git a/examples/inline/dist/webpack-5/bundle.js b/examples/inline/dist/webpack-5/bundle.js new file mode 100644 index 00000000..e8487f4b --- /dev/null +++ b/examples/inline/dist/webpack-5/bundle.js @@ -0,0 +1,63 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 636: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ if(__webpack_module_cache__[moduleId]) { +/******/ return __webpack_module_cache__[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { + +__webpack_require__(636); + +console.log('Hello World'); + +})(); + +/******/ })() +; \ No newline at end of file diff --git a/examples/favicon/dist/webpack-3/favicon.ico b/examples/inline/dist/webpack-5/favicon.ico similarity index 100% rename from examples/favicon/dist/webpack-3/favicon.ico rename to examples/inline/dist/webpack-5/favicon.ico diff --git a/examples/inline/dist/webpack-5/index.html b/examples/inline/dist/webpack-5/index.html new file mode 100644 index 00000000..c401f660 --- /dev/null +++ b/examples/inline/dist/webpack-5/index.html @@ -0,0 +1,65 @@ +pug demo \ No newline at end of file diff --git a/examples/custom-template/dist/webpack-2/styles.css b/examples/inline/dist/webpack-5/styles.css similarity index 93% rename from examples/custom-template/dist/webpack-2/styles.css rename to examples/inline/dist/webpack-5/styles.css index 232a2cdb..e86486ba 100644 --- a/examples/custom-template/dist/webpack-2/styles.css +++ b/examples/inline/dist/webpack-5/styles.css @@ -1,3 +1,3 @@ body { background: snow; -} \ No newline at end of file +} diff --git a/examples/inline/readme.md b/examples/inline/readme.md index 1d58a191..df551640 100644 --- a/examples/inline/readme.md +++ b/examples/inline/readme.md @@ -1,4 +1,4 @@ -# isomorphic jade example +# isomorphic pug example -This example shows how to use a different template engine (in this case jade) -to load the `time.jade` template on the backend and frontend. +This example shows how to use a different template engine (in this case pug) +to load the `time.pug` template on the backend and frontend. diff --git a/examples/inline/template.jade b/examples/inline/template.pug similarity index 58% rename from examples/inline/template.jade rename to examples/inline/template.pug index cc47fd6a..b4337d6a 100644 --- a/examples/inline/template.jade +++ b/examples/inline/template.pug @@ -1,10 +1,10 @@ doctype html html head - meta(http-equiv="Content-type" content="text/html; charset=utf-8") + meta(charset="utf-8") title #{htmlWebpackPlugin.options.title} body each cssFile in htmlWebpackPlugin.files.css style !{compilation.assets[cssFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()} each jsFile in htmlWebpackPlugin.files.js - script(type="text/javascript") !{compilation.assets[jsFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()} + script !{compilation.assets[jsFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()} diff --git a/examples/inline/webpack.config.js b/examples/inline/webpack.config.js index 15cabfdb..752644a5 100755 --- a/examples/inline/webpack.config.js +++ b/examples/inline/webpack.config.js @@ -1,6 +1,6 @@ var path = require('path'); var HtmlWebpackPlugin = require('../..'); -var ExtractTextPlugin = require('extract-text-webpack-plugin'); +var MiniCssExtractPlugin = require('mini-css-extract-plugin'); var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; module.exports = { @@ -12,20 +12,20 @@ module.exports = { filename: 'bundle.js' }, module: { - loaders: [ - { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, - { test: /\.jade$/, loader: 'jade-loader' } + rules: [ + { test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader'] }, + { test: /\.pug$/, loader: 'pug-loader' } ] }, plugins: [ new HtmlWebpackPlugin({ inject: false, cache: false, - template: 'template.jade', + template: 'template.pug', filename: 'index.html', favicon: 'favicon.ico', - title: 'Jade demo' + title: 'pug demo' }), - new ExtractTextPlugin('styles.css') + new MiniCssExtractPlugin({ filename: 'styles.css' }) ] }; diff --git a/examples/jade-loader/dist/webpack-1/0714810ae3fb211173e2964249507195.png b/examples/jade-loader/dist/webpack-1/0714810ae3fb211173e2964249507195.png deleted file mode 100644 index d71b3d78..00000000 Binary files a/examples/jade-loader/dist/webpack-1/0714810ae3fb211173e2964249507195.png and /dev/null differ diff --git a/examples/jade-loader/dist/webpack-1/bundle.js b/examples/jade-loader/dist/webpack-1/bundle.js deleted file mode 100644 index 555e7866..00000000 --- a/examples/jade-loader/dist/webpack-1/bundle.js +++ /dev/null @@ -1,347 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - __webpack_require__(1); - // Use the same template for the frontend code - var template = __webpack_require__(5); - - setInterval(function () { - var div = document.getElementById('main'); - div.innerHTML = template({ time: new Date() }); - div.style.color = 'navy'; - }, 1000); - - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - - // removed by extract-text-webpack-plugin - -/***/ }), -/* 2 */, -/* 3 */, -/* 4 */, -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - - var jade = __webpack_require__(6); - - module.exports = function template(locals) { - var buf = []; - var jade_mixins = {}; - var jade_interp; - ;var locals_for_with = (locals || {});(function (time) { - buf.push("
Current time

" + (jade.escape((jade_interp = time.toISOString()) == null ? '' : jade_interp)) + "

");}.call(this,"time" in locals_for_with?locals_for_with.time:typeof time!=="undefined"?time:undefined));;return buf.join(""); - } - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - /** - * Merge two attribute objects giving precedence - * to values in object `b`. Classes are special-cased - * allowing for arrays and merging/joining appropriately - * resulting in a string. - * - * @param {Object} a - * @param {Object} b - * @return {Object} a - * @api private - */ - - exports.merge = function merge(a, b) { - if (arguments.length === 1) { - var attrs = a[0]; - for (var i = 1; i < a.length; i++) { - attrs = merge(attrs, a[i]); - } - return attrs; - } - var ac = a['class']; - var bc = b['class']; - - if (ac || bc) { - ac = ac || []; - bc = bc || []; - if (!Array.isArray(ac)) ac = [ac]; - if (!Array.isArray(bc)) bc = [bc]; - a['class'] = ac.concat(bc).filter(nulls); - } - - for (var key in b) { - if (key != 'class') { - a[key] = b[key]; - } - } - - return a; - }; - - /** - * Filter null `val`s. - * - * @param {*} val - * @return {Boolean} - * @api private - */ - - function nulls(val) { - return val != null && val !== ''; - } - - /** - * join array as classes. - * - * @param {*} val - * @return {String} - */ - exports.joinClasses = joinClasses; - function joinClasses(val) { - return (Array.isArray(val) ? val.map(joinClasses) : - (val && typeof val === 'object') ? Object.keys(val).filter(function (key) { return val[key]; }) : - [val]).filter(nulls).join(' '); - } - - /** - * Render the given classes. - * - * @param {Array} classes - * @param {Array.} escaped - * @return {String} - */ - exports.cls = function cls(classes, escaped) { - var buf = []; - for (var i = 0; i < classes.length; i++) { - if (escaped && escaped[i]) { - buf.push(exports.escape(joinClasses([classes[i]]))); - } else { - buf.push(joinClasses(classes[i])); - } - } - var text = joinClasses(buf); - if (text.length) { - return ' class="' + text + '"'; - } else { - return ''; - } - }; - - - exports.style = function (val) { - if (val && typeof val === 'object') { - return Object.keys(val).map(function (style) { - return style + ':' + val[style]; - }).join(';'); - } else { - return val; - } - }; - /** - * Render the given attribute. - * - * @param {String} key - * @param {String} val - * @param {Boolean} escaped - * @param {Boolean} terse - * @return {String} - */ - exports.attr = function attr(key, val, escaped, terse) { - if (key === 'style') { - val = exports.style(val); - } - if ('boolean' == typeof val || null == val) { - if (val) { - return ' ' + (terse ? key : key + '="' + key + '"'); - } else { - return ''; - } - } else if (0 == key.indexOf('data') && 'string' != typeof val) { - if (JSON.stringify(val).indexOf('&') !== -1) { - console.warn('Since Jade 2.0.0, ampersands (`&`) in data attributes ' + - 'will be escaped to `&`'); - }; - if (val && typeof val.toISOString === 'function') { - console.warn('Jade will eliminate the double quotes around dates in ' + - 'ISO form after 2.0.0'); - } - return ' ' + key + "='" + JSON.stringify(val).replace(/'/g, ''') + "'"; - } else if (escaped) { - if (val && typeof val.toISOString === 'function') { - console.warn('Jade will stringify dates in ISO form after 2.0.0'); - } - return ' ' + key + '="' + exports.escape(val) + '"'; - } else { - if (val && typeof val.toISOString === 'function') { - console.warn('Jade will stringify dates in ISO form after 2.0.0'); - } - return ' ' + key + '="' + val + '"'; - } - }; - - /** - * Render the given attributes object. - * - * @param {Object} obj - * @param {Object} escaped - * @return {String} - */ - exports.attrs = function attrs(obj, terse){ - var buf = []; - - var keys = Object.keys(obj); - - if (keys.length) { - for (var i = 0; i < keys.length; ++i) { - var key = keys[i] - , val = obj[key]; - - if ('class' == key) { - if (val = joinClasses(val)) { - buf.push(' ' + key + '="' + val + '"'); - } - } else { - buf.push(exports.attr(key, val, false, terse)); - } - } - } - - return buf.join(''); - }; - - /** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - - var jade_encode_html_rules = { - '&': '&', - '<': '<', - '>': '>', - '"': '"' - }; - var jade_match_html = /[&<>"]/g; - - function jade_encode_char(c) { - return jade_encode_html_rules[c] || c; - } - - exports.escape = jade_escape; - function jade_escape(html){ - var result = String(html).replace(jade_match_html, jade_encode_char); - if (result === '' + html) return html; - else return result; - }; - - /** - * Re-throw the given `err` in context to the - * the jade in `filename` at the given `lineno`. - * - * @param {Error} err - * @param {String} filename - * @param {String} lineno - * @api private - */ - - exports.rethrow = function rethrow(err, filename, lineno, str){ - if (!(err instanceof Error)) throw err; - if ((typeof window != 'undefined' || !filename) && !str) { - err.message += ' on line ' + lineno; - throw err; - } - try { - str = str || __webpack_require__(7).readFileSync(filename, 'utf8') - } catch (ex) { - rethrow(err, null, lineno) - } - var context = 3 - , lines = str.split('\n') - , start = Math.max(lineno - context, 0) - , end = Math.min(lines.length, lineno + context); - - // Error context - var context = lines.slice(start, end).map(function(line, i){ - var curr = i + start + 1; - return (curr == lineno ? ' > ' : ' ') - + curr - + '| ' - + line; - }).join('\n'); - - // Alter exception message - err.path = filename; - err.message = (filename || 'Jade') + ':' + lineno - + '\n' + context + '\n\n' + err.message; - throw err; - }; - - exports.DebugItem = function DebugItem(lineno, filename) { - this.lineno = lineno; - this.filename = filename; - } - - -/***/ }), -/* 7 */ -/***/ (function(module, exports) { - - /* (ignored) */ - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__.p + "0714810ae3fb211173e2964249507195.png"; - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/jade-loader/dist/webpack-1/favicon.ico b/examples/jade-loader/dist/webpack-1/favicon.ico deleted file mode 100644 index be74abd6..00000000 Binary files a/examples/jade-loader/dist/webpack-1/favicon.ico and /dev/null differ diff --git a/examples/jade-loader/dist/webpack-1/index.html b/examples/jade-loader/dist/webpack-1/index.html deleted file mode 100644 index f1821b3c..00000000 --- a/examples/jade-loader/dist/webpack-1/index.html +++ /dev/null @@ -1 +0,0 @@ -Jade demo
Current time

1998-12-31T23:00:00.000Z

\ No newline at end of file diff --git a/examples/jade-loader/dist/webpack-1/styles.css b/examples/jade-loader/dist/webpack-1/styles.css deleted file mode 100644 index 232a2cdb..00000000 --- a/examples/jade-loader/dist/webpack-1/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: snow; -} \ No newline at end of file diff --git a/examples/jade-loader/dist/webpack-2/0714810ae3fb211173e2964249507195.png b/examples/jade-loader/dist/webpack-2/0714810ae3fb211173e2964249507195.png deleted file mode 100644 index d71b3d78..00000000 Binary files a/examples/jade-loader/dist/webpack-2/0714810ae3fb211173e2964249507195.png and /dev/null differ diff --git a/examples/jade-loader/dist/webpack-2/bundle.js b/examples/jade-loader/dist/webpack-2/bundle.js deleted file mode 100644 index aef75c6a..00000000 --- a/examples/jade-loader/dist/webpack-2/bundle.js +++ /dev/null @@ -1,372 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 2); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -var jade = __webpack_require__(4); - -module.exports = function template(locals) { -var buf = []; -var jade_mixins = {}; -var jade_interp; -;var locals_for_with = (locals || {});(function (time) { -buf.push("
Current time

" + (jade.escape((jade_interp = time.toISOString()) == null ? '' : jade_interp)) + "

");}.call(this,"time" in locals_for_with?locals_for_with.time:typeof time!=="undefined"?time:undefined));;return buf.join(""); -} - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -__webpack_require__(0); -// Use the same template for the frontend code -var template = __webpack_require__(1); - -setInterval(function () { - var div = document.getElementById('main'); - div.innerHTML = template({ time: new Date() }); - div.style.color = 'navy'; -}, 1000); - - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__.p + "0714810ae3fb211173e2964249507195.png"; - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/** - * Merge two attribute objects giving precedence - * to values in object `b`. Classes are special-cased - * allowing for arrays and merging/joining appropriately - * resulting in a string. - * - * @param {Object} a - * @param {Object} b - * @return {Object} a - * @api private - */ - -exports.merge = function merge(a, b) { - if (arguments.length === 1) { - var attrs = a[0]; - for (var i = 1; i < a.length; i++) { - attrs = merge(attrs, a[i]); - } - return attrs; - } - var ac = a['class']; - var bc = b['class']; - - if (ac || bc) { - ac = ac || []; - bc = bc || []; - if (!Array.isArray(ac)) ac = [ac]; - if (!Array.isArray(bc)) bc = [bc]; - a['class'] = ac.concat(bc).filter(nulls); - } - - for (var key in b) { - if (key != 'class') { - a[key] = b[key]; - } - } - - return a; -}; - -/** - * Filter null `val`s. - * - * @param {*} val - * @return {Boolean} - * @api private - */ - -function nulls(val) { - return val != null && val !== ''; -} - -/** - * join array as classes. - * - * @param {*} val - * @return {String} - */ -exports.joinClasses = joinClasses; -function joinClasses(val) { - return (Array.isArray(val) ? val.map(joinClasses) : - (val && typeof val === 'object') ? Object.keys(val).filter(function (key) { return val[key]; }) : - [val]).filter(nulls).join(' '); -} - -/** - * Render the given classes. - * - * @param {Array} classes - * @param {Array.} escaped - * @return {String} - */ -exports.cls = function cls(classes, escaped) { - var buf = []; - for (var i = 0; i < classes.length; i++) { - if (escaped && escaped[i]) { - buf.push(exports.escape(joinClasses([classes[i]]))); - } else { - buf.push(joinClasses(classes[i])); - } - } - var text = joinClasses(buf); - if (text.length) { - return ' class="' + text + '"'; - } else { - return ''; - } -}; - - -exports.style = function (val) { - if (val && typeof val === 'object') { - return Object.keys(val).map(function (style) { - return style + ':' + val[style]; - }).join(';'); - } else { - return val; - } -}; -/** - * Render the given attribute. - * - * @param {String} key - * @param {String} val - * @param {Boolean} escaped - * @param {Boolean} terse - * @return {String} - */ -exports.attr = function attr(key, val, escaped, terse) { - if (key === 'style') { - val = exports.style(val); - } - if ('boolean' == typeof val || null == val) { - if (val) { - return ' ' + (terse ? key : key + '="' + key + '"'); - } else { - return ''; - } - } else if (0 == key.indexOf('data') && 'string' != typeof val) { - if (JSON.stringify(val).indexOf('&') !== -1) { - console.warn('Since Jade 2.0.0, ampersands (`&`) in data attributes ' + - 'will be escaped to `&`'); - }; - if (val && typeof val.toISOString === 'function') { - console.warn('Jade will eliminate the double quotes around dates in ' + - 'ISO form after 2.0.0'); - } - return ' ' + key + "='" + JSON.stringify(val).replace(/'/g, ''') + "'"; - } else if (escaped) { - if (val && typeof val.toISOString === 'function') { - console.warn('Jade will stringify dates in ISO form after 2.0.0'); - } - return ' ' + key + '="' + exports.escape(val) + '"'; - } else { - if (val && typeof val.toISOString === 'function') { - console.warn('Jade will stringify dates in ISO form after 2.0.0'); - } - return ' ' + key + '="' + val + '"'; - } -}; - -/** - * Render the given attributes object. - * - * @param {Object} obj - * @param {Object} escaped - * @return {String} - */ -exports.attrs = function attrs(obj, terse){ - var buf = []; - - var keys = Object.keys(obj); - - if (keys.length) { - for (var i = 0; i < keys.length; ++i) { - var key = keys[i] - , val = obj[key]; - - if ('class' == key) { - if (val = joinClasses(val)) { - buf.push(' ' + key + '="' + val + '"'); - } - } else { - buf.push(exports.attr(key, val, false, terse)); - } - } - } - - return buf.join(''); -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -var jade_encode_html_rules = { - '&': '&', - '<': '<', - '>': '>', - '"': '"' -}; -var jade_match_html = /[&<>"]/g; - -function jade_encode_char(c) { - return jade_encode_html_rules[c] || c; -} - -exports.escape = jade_escape; -function jade_escape(html){ - var result = String(html).replace(jade_match_html, jade_encode_char); - if (result === '' + html) return html; - else return result; -}; - -/** - * Re-throw the given `err` in context to the - * the jade in `filename` at the given `lineno`. - * - * @param {Error} err - * @param {String} filename - * @param {String} lineno - * @api private - */ - -exports.rethrow = function rethrow(err, filename, lineno, str){ - if (!(err instanceof Error)) throw err; - if ((typeof window != 'undefined' || !filename) && !str) { - err.message += ' on line ' + lineno; - throw err; - } - try { - str = str || __webpack_require__(5).readFileSync(filename, 'utf8') - } catch (ex) { - rethrow(err, null, lineno) - } - var context = 3 - , lines = str.split('\n') - , start = Math.max(lineno - context, 0) - , end = Math.min(lines.length, lineno + context); - - // Error context - var context = lines.slice(start, end).map(function(line, i){ - var curr = i + start + 1; - return (curr == lineno ? ' > ' : ' ') - + curr - + '| ' - + line; - }).join('\n'); - - // Alter exception message - err.path = filename; - err.message = (filename || 'Jade') + ':' + lineno - + '\n' + context + '\n\n' + err.message; - throw err; -}; - -exports.DebugItem = function DebugItem(lineno, filename) { - this.lineno = lineno; - this.filename = filename; -} - - -/***/ }), -/* 5 */ -/***/ (function(module, exports) { - -/* (ignored) */ - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/jade-loader/dist/webpack-2/favicon.ico b/examples/jade-loader/dist/webpack-2/favicon.ico deleted file mode 100644 index be74abd6..00000000 Binary files a/examples/jade-loader/dist/webpack-2/favicon.ico and /dev/null differ diff --git a/examples/jade-loader/dist/webpack-2/index.html b/examples/jade-loader/dist/webpack-2/index.html deleted file mode 100644 index f1821b3c..00000000 --- a/examples/jade-loader/dist/webpack-2/index.html +++ /dev/null @@ -1 +0,0 @@ -Jade demo
Current time

1998-12-31T23:00:00.000Z

\ No newline at end of file diff --git a/examples/jade-loader/dist/webpack-2/styles.css b/examples/jade-loader/dist/webpack-2/styles.css deleted file mode 100644 index 232a2cdb..00000000 --- a/examples/jade-loader/dist/webpack-2/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: snow; -} \ No newline at end of file diff --git a/examples/jade-loader/dist/webpack-3/0714810ae3fb211173e2964249507195.png b/examples/jade-loader/dist/webpack-3/0714810ae3fb211173e2964249507195.png deleted file mode 100644 index d71b3d78..00000000 Binary files a/examples/jade-loader/dist/webpack-3/0714810ae3fb211173e2964249507195.png and /dev/null differ diff --git a/examples/jade-loader/dist/webpack-3/bundle.js b/examples/jade-loader/dist/webpack-3/bundle.js deleted file mode 100644 index 8bee19da..00000000 --- a/examples/jade-loader/dist/webpack-3/bundle.js +++ /dev/null @@ -1,369 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -__webpack_require__(1); -// Use the same template for the frontend code -var template = __webpack_require__(2); - -setInterval(function () { - var div = document.getElementById('main'); - div.innerHTML = template({ time: new Date() }); - div.style.color = 'navy'; -}, 1000); - - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -var jade = __webpack_require__(3); - -module.exports = function template(locals) { -var buf = []; -var jade_mixins = {}; -var jade_interp; -;var locals_for_with = (locals || {});(function (time) { -buf.push("
Current time

" + (jade.escape((jade_interp = time.toISOString()) == null ? '' : jade_interp)) + "

");}.call(this,"time" in locals_for_with?locals_for_with.time:typeof time!=="undefined"?time:undefined));;return buf.join(""); -} - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/** - * Merge two attribute objects giving precedence - * to values in object `b`. Classes are special-cased - * allowing for arrays and merging/joining appropriately - * resulting in a string. - * - * @param {Object} a - * @param {Object} b - * @return {Object} a - * @api private - */ - -exports.merge = function merge(a, b) { - if (arguments.length === 1) { - var attrs = a[0]; - for (var i = 1; i < a.length; i++) { - attrs = merge(attrs, a[i]); - } - return attrs; - } - var ac = a['class']; - var bc = b['class']; - - if (ac || bc) { - ac = ac || []; - bc = bc || []; - if (!Array.isArray(ac)) ac = [ac]; - if (!Array.isArray(bc)) bc = [bc]; - a['class'] = ac.concat(bc).filter(nulls); - } - - for (var key in b) { - if (key != 'class') { - a[key] = b[key]; - } - } - - return a; -}; - -/** - * Filter null `val`s. - * - * @param {*} val - * @return {Boolean} - * @api private - */ - -function nulls(val) { - return val != null && val !== ''; -} - -/** - * join array as classes. - * - * @param {*} val - * @return {String} - */ -exports.joinClasses = joinClasses; -function joinClasses(val) { - return (Array.isArray(val) ? val.map(joinClasses) : - (val && typeof val === 'object') ? Object.keys(val).filter(function (key) { return val[key]; }) : - [val]).filter(nulls).join(' '); -} - -/** - * Render the given classes. - * - * @param {Array} classes - * @param {Array.} escaped - * @return {String} - */ -exports.cls = function cls(classes, escaped) { - var buf = []; - for (var i = 0; i < classes.length; i++) { - if (escaped && escaped[i]) { - buf.push(exports.escape(joinClasses([classes[i]]))); - } else { - buf.push(joinClasses(classes[i])); - } - } - var text = joinClasses(buf); - if (text.length) { - return ' class="' + text + '"'; - } else { - return ''; - } -}; - - -exports.style = function (val) { - if (val && typeof val === 'object') { - return Object.keys(val).map(function (style) { - return style + ':' + val[style]; - }).join(';'); - } else { - return val; - } -}; -/** - * Render the given attribute. - * - * @param {String} key - * @param {String} val - * @param {Boolean} escaped - * @param {Boolean} terse - * @return {String} - */ -exports.attr = function attr(key, val, escaped, terse) { - if (key === 'style') { - val = exports.style(val); - } - if ('boolean' == typeof val || null == val) { - if (val) { - return ' ' + (terse ? key : key + '="' + key + '"'); - } else { - return ''; - } - } else if (0 == key.indexOf('data') && 'string' != typeof val) { - if (JSON.stringify(val).indexOf('&') !== -1) { - console.warn('Since Jade 2.0.0, ampersands (`&`) in data attributes ' + - 'will be escaped to `&`'); - }; - if (val && typeof val.toISOString === 'function') { - console.warn('Jade will eliminate the double quotes around dates in ' + - 'ISO form after 2.0.0'); - } - return ' ' + key + "='" + JSON.stringify(val).replace(/'/g, ''') + "'"; - } else if (escaped) { - if (val && typeof val.toISOString === 'function') { - console.warn('Jade will stringify dates in ISO form after 2.0.0'); - } - return ' ' + key + '="' + exports.escape(val) + '"'; - } else { - if (val && typeof val.toISOString === 'function') { - console.warn('Jade will stringify dates in ISO form after 2.0.0'); - } - return ' ' + key + '="' + val + '"'; - } -}; - -/** - * Render the given attributes object. - * - * @param {Object} obj - * @param {Object} escaped - * @return {String} - */ -exports.attrs = function attrs(obj, terse){ - var buf = []; - - var keys = Object.keys(obj); - - if (keys.length) { - for (var i = 0; i < keys.length; ++i) { - var key = keys[i] - , val = obj[key]; - - if ('class' == key) { - if (val = joinClasses(val)) { - buf.push(' ' + key + '="' + val + '"'); - } - } else { - buf.push(exports.attr(key, val, false, terse)); - } - } - } - - return buf.join(''); -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -var jade_encode_html_rules = { - '&': '&', - '<': '<', - '>': '>', - '"': '"' -}; -var jade_match_html = /[&<>"]/g; - -function jade_encode_char(c) { - return jade_encode_html_rules[c] || c; -} - -exports.escape = jade_escape; -function jade_escape(html){ - var result = String(html).replace(jade_match_html, jade_encode_char); - if (result === '' + html) return html; - else return result; -}; - -/** - * Re-throw the given `err` in context to the - * the jade in `filename` at the given `lineno`. - * - * @param {Error} err - * @param {String} filename - * @param {String} lineno - * @api private - */ - -exports.rethrow = function rethrow(err, filename, lineno, str){ - if (!(err instanceof Error)) throw err; - if ((typeof window != 'undefined' || !filename) && !str) { - err.message += ' on line ' + lineno; - throw err; - } - try { - str = str || __webpack_require__(4).readFileSync(filename, 'utf8') - } catch (ex) { - rethrow(err, null, lineno) - } - var context = 3 - , lines = str.split('\n') - , start = Math.max(lineno - context, 0) - , end = Math.min(lines.length, lineno + context); - - // Error context - var context = lines.slice(start, end).map(function(line, i){ - var curr = i + start + 1; - return (curr == lineno ? ' > ' : ' ') - + curr - + '| ' - + line; - }).join('\n'); - - // Alter exception message - err.path = filename; - err.message = (filename || 'Jade') + ':' + lineno - + '\n' + context + '\n\n' + err.message; - throw err; -}; - -exports.DebugItem = function DebugItem(lineno, filename) { - this.lineno = lineno; - this.filename = filename; -} - - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - -/* (ignored) */ - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__.p + "0714810ae3fb211173e2964249507195.png"; - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/jade-loader/dist/webpack-3/favicon.ico b/examples/jade-loader/dist/webpack-3/favicon.ico deleted file mode 100644 index be74abd6..00000000 Binary files a/examples/jade-loader/dist/webpack-3/favicon.ico and /dev/null differ diff --git a/examples/jade-loader/dist/webpack-3/index.html b/examples/jade-loader/dist/webpack-3/index.html deleted file mode 100644 index 916fa078..00000000 --- a/examples/jade-loader/dist/webpack-3/index.html +++ /dev/null @@ -1 +0,0 @@ -Jade demo
Current time

1999-01-01T00:00:00.000Z

\ No newline at end of file diff --git a/examples/jade-loader/dist/webpack-3/styles.css b/examples/jade-loader/dist/webpack-3/styles.css deleted file mode 100644 index 232a2cdb..00000000 --- a/examples/jade-loader/dist/webpack-3/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: snow; -} \ No newline at end of file diff --git a/examples/jade-loader/favicon.ico b/examples/jade-loader/favicon.ico deleted file mode 100644 index be74abd6..00000000 Binary files a/examples/jade-loader/favicon.ico and /dev/null differ diff --git a/examples/jade-loader/readme.md b/examples/jade-loader/readme.md deleted file mode 100644 index 1d58a191..00000000 --- a/examples/jade-loader/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -# isomorphic jade example - -This example shows how to use a different template engine (in this case jade) -to load the `time.jade` template on the backend and frontend. diff --git a/examples/javascript-advanced/dist/webpack-1/0714810ae3fb211173e2964249507195.png b/examples/javascript-advanced/dist/webpack-1/0714810ae3fb211173e2964249507195.png deleted file mode 100644 index d71b3d78..00000000 Binary files a/examples/javascript-advanced/dist/webpack-1/0714810ae3fb211173e2964249507195.png and /dev/null differ diff --git a/examples/javascript-advanced/dist/webpack-1/bundle.js b/examples/javascript-advanced/dist/webpack-1/bundle.js deleted file mode 100644 index 6680bd13..00000000 --- a/examples/javascript-advanced/dist/webpack-1/bundle.js +++ /dev/null @@ -1,65 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(5);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 0\n// module chunks = 0\n//# sourceURL=webpack:///./example.js?"); - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - - eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n//# sourceURL=webpack:///./main.css?"); - -/***/ }), -/* 2 */, -/* 3 */, -/* 4 */, -/* 5 */ -/***/ (function(module, exports) { - - eval("// This file is used for frontend and backend\n'use strict';\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 5\n// module chunks = 0\n//# sourceURL=webpack:///./universial.js?"); - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-1/index.html b/examples/javascript-advanced/dist/webpack-1/index.html deleted file mode 100644 index 61d6408d..00000000 --- a/examples/javascript-advanced/dist/webpack-1/index.html +++ /dev/null @@ -1,2 +0,0 @@ -Webpack AppHello World from backend -

Partial

- \ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-1/styles.css b/examples/javascript-advanced/dist/webpack-1/styles.css deleted file mode 100644 index 232a2cdb..00000000 --- a/examples/javascript-advanced/dist/webpack-1/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: snow; -} \ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-2/0714810ae3fb211173e2964249507195.png b/examples/javascript-advanced/dist/webpack-2/0714810ae3fb211173e2964249507195.png deleted file mode 100644 index d71b3d78..00000000 Binary files a/examples/javascript-advanced/dist/webpack-2/0714810ae3fb211173e2964249507195.png and /dev/null differ diff --git a/examples/javascript-advanced/dist/webpack-2/bundle.js b/examples/javascript-advanced/dist/webpack-2/bundle.js deleted file mode 100644 index e0b6b46c..00000000 --- a/examples/javascript-advanced/dist/webpack-2/bundle.js +++ /dev/null @@ -1,89 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 2); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("// This file is used for frontend and backend\n\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///./universial.js?"); - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n\n//# sourceURL=webpack:///./main.css?"); - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(0);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 2\n// module chunks = 0\n\n//# sourceURL=webpack:///./example.js?"); - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-2/index.html b/examples/javascript-advanced/dist/webpack-2/index.html deleted file mode 100644 index 61d6408d..00000000 --- a/examples/javascript-advanced/dist/webpack-2/index.html +++ /dev/null @@ -1,2 +0,0 @@ -Webpack AppHello World from backend -

Partial

- \ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-2/styles.css b/examples/javascript-advanced/dist/webpack-2/styles.css deleted file mode 100644 index 232a2cdb..00000000 --- a/examples/javascript-advanced/dist/webpack-2/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: snow; -} \ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-3/0714810ae3fb211173e2964249507195.png b/examples/javascript-advanced/dist/webpack-3/0714810ae3fb211173e2964249507195.png deleted file mode 100644 index d71b3d78..00000000 Binary files a/examples/javascript-advanced/dist/webpack-3/0714810ae3fb211173e2964249507195.png and /dev/null differ diff --git a/examples/javascript-advanced/dist/webpack-3/bundle.js b/examples/javascript-advanced/dist/webpack-3/bundle.js deleted file mode 100644 index 2d9e545d..00000000 --- a/examples/javascript-advanced/dist/webpack-3/bundle.js +++ /dev/null @@ -1,86 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(2);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///./example.js?"); - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n\n//# sourceURL=webpack:///./main.css?"); - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("// This file is used for frontend and backend\n\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 2\n// module chunks = 0\n\n//# sourceURL=webpack:///./universial.js?"); - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-3/index.html b/examples/javascript-advanced/dist/webpack-3/index.html deleted file mode 100644 index 61d6408d..00000000 --- a/examples/javascript-advanced/dist/webpack-3/index.html +++ /dev/null @@ -1,2 +0,0 @@ -Webpack AppHello World from backend -

Partial

- \ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-3/styles.css b/examples/javascript-advanced/dist/webpack-3/styles.css deleted file mode 100644 index 232a2cdb..00000000 --- a/examples/javascript-advanced/dist/webpack-3/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: snow; -} \ No newline at end of file diff --git a/examples/appcache/dist/webpack-3/0714810ae3fb211173e2964249507195.png b/examples/javascript-advanced/dist/webpack-5/55b19870aff2e53d1fb1.png similarity index 100% rename from examples/appcache/dist/webpack-3/0714810ae3fb211173e2964249507195.png rename to examples/javascript-advanced/dist/webpack-5/55b19870aff2e53d1fb1.png diff --git a/examples/javascript-advanced/dist/webpack-5/bundle.js b/examples/javascript-advanced/dist/webpack-5/bundle.js new file mode 100644 index 00000000..21942cec --- /dev/null +++ b/examples/javascript-advanced/dist/webpack-5/bundle.js @@ -0,0 +1,80 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 144: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +eval("__webpack_require__(636);\n\nvar universal = __webpack_require__(184);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//# sourceURL=webpack:///./example.js?"); + +/***/ }), + +/***/ 184: +/***/ ((module) => { + +"use strict"; +eval("// This file is used for frontend and backend\n\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//# sourceURL=webpack:///./universial.js?"); + +/***/ }), + +/***/ 636: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack:///./main.css?"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ if(__webpack_module_cache__[moduleId]) { +/******/ return __webpack_module_cache__[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval devtool is used. +/******/ var __webpack_exports__ = __webpack_require__(144); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-5/index.html b/examples/javascript-advanced/dist/webpack-5/index.html new file mode 100644 index 00000000..216fe107 --- /dev/null +++ b/examples/javascript-advanced/dist/webpack-5/index.html @@ -0,0 +1 @@ +Webpack AppHello World from backend -

Partial

\ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-5/styles.css b/examples/javascript-advanced/dist/webpack-5/styles.css new file mode 100644 index 00000000..e86486ba --- /dev/null +++ b/examples/javascript-advanced/dist/webpack-5/styles.css @@ -0,0 +1,3 @@ +body { + background: snow; +} diff --git a/examples/javascript-advanced/template.js b/examples/javascript-advanced/template.js index bd0f7058..2b006a25 100644 --- a/examples/javascript-advanced/template.js +++ b/examples/javascript-advanced/template.js @@ -1,5 +1,5 @@ // Webpack require: -var partial = require('./partial.html'); +var partial = require('./partial.html').default; var universal = require('./universial.js'); // Export a function / promise / or a string: diff --git a/examples/javascript-advanced/webpack.config.js b/examples/javascript-advanced/webpack.config.js index d1d3d636..a8e1af64 100644 --- a/examples/javascript-advanced/webpack.config.js +++ b/examples/javascript-advanced/webpack.config.js @@ -1,7 +1,8 @@ var path = require('path'); var HtmlWebpackPlugin = require('../..'); -var ExtractTextPlugin = require('extract-text-webpack-plugin'); +var MiniCssExtractPlugin = require('mini-css-extract-plugin'); var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; + module.exports = { context: __dirname, entry: './example.js', @@ -11,9 +12,9 @@ module.exports = { filename: 'bundle.js' }, module: { - loaders: [ - { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, - { test: /\.png$/, loader: 'file-loader' }, + rules: [ + { test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader'] }, + { test: /\.png$/, type: 'asset/resource' }, { test: /\.html$/, loader: 'html-loader' } ] }, @@ -22,6 +23,6 @@ module.exports = { new HtmlWebpackPlugin({ template: 'template.js' }), - new ExtractTextPlugin('styles.css') + new MiniCssExtractPlugin({ filename: 'styles.css' }) ] }; diff --git a/examples/javascript/dist/webpack-1/0714810ae3fb211173e2964249507195.png b/examples/javascript/dist/webpack-1/0714810ae3fb211173e2964249507195.png deleted file mode 100644 index d71b3d78..00000000 Binary files a/examples/javascript/dist/webpack-1/0714810ae3fb211173e2964249507195.png and /dev/null differ diff --git a/examples/javascript/dist/webpack-1/bundle.js b/examples/javascript/dist/webpack-1/bundle.js deleted file mode 100644 index 6680bd13..00000000 --- a/examples/javascript/dist/webpack-1/bundle.js +++ /dev/null @@ -1,65 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(5);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 0\n// module chunks = 0\n//# sourceURL=webpack:///./example.js?"); - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - - eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n//# sourceURL=webpack:///./main.css?"); - -/***/ }), -/* 2 */, -/* 3 */, -/* 4 */, -/* 5 */ -/***/ (function(module, exports) { - - eval("// This file is used for frontend and backend\n'use strict';\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 5\n// module chunks = 0\n//# sourceURL=webpack:///./universial.js?"); - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/javascript/dist/webpack-1/index.html b/examples/javascript/dist/webpack-1/index.html deleted file mode 100644 index 88e071b9..00000000 --- a/examples/javascript/dist/webpack-1/index.html +++ /dev/null @@ -1,2 +0,0 @@ -Hello World from backend2017-04-17T17:13:11.491Z

Partial

- \ No newline at end of file diff --git a/examples/javascript/dist/webpack-1/styles.css b/examples/javascript/dist/webpack-1/styles.css deleted file mode 100644 index 232a2cdb..00000000 --- a/examples/javascript/dist/webpack-1/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: snow; -} \ No newline at end of file diff --git a/examples/javascript/dist/webpack-2/0714810ae3fb211173e2964249507195.png b/examples/javascript/dist/webpack-2/0714810ae3fb211173e2964249507195.png deleted file mode 100644 index d71b3d78..00000000 Binary files a/examples/javascript/dist/webpack-2/0714810ae3fb211173e2964249507195.png and /dev/null differ diff --git a/examples/javascript/dist/webpack-2/bundle.js b/examples/javascript/dist/webpack-2/bundle.js deleted file mode 100644 index e0b6b46c..00000000 --- a/examples/javascript/dist/webpack-2/bundle.js +++ /dev/null @@ -1,89 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 2); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("// This file is used for frontend and backend\n\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///./universial.js?"); - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n\n//# sourceURL=webpack:///./main.css?"); - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(0);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 2\n// module chunks = 0\n\n//# sourceURL=webpack:///./example.js?"); - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/javascript/dist/webpack-2/index.html b/examples/javascript/dist/webpack-2/index.html deleted file mode 100644 index 71f92f66..00000000 --- a/examples/javascript/dist/webpack-2/index.html +++ /dev/null @@ -1,2 +0,0 @@ -Hello World from backend2017-04-17T17:12:14.752Z

Partial

- \ No newline at end of file diff --git a/examples/javascript/dist/webpack-2/styles.css b/examples/javascript/dist/webpack-2/styles.css deleted file mode 100644 index 232a2cdb..00000000 --- a/examples/javascript/dist/webpack-2/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: snow; -} \ No newline at end of file diff --git a/examples/javascript/dist/webpack-3/0714810ae3fb211173e2964249507195.png b/examples/javascript/dist/webpack-3/0714810ae3fb211173e2964249507195.png deleted file mode 100644 index d71b3d78..00000000 Binary files a/examples/javascript/dist/webpack-3/0714810ae3fb211173e2964249507195.png and /dev/null differ diff --git a/examples/javascript/dist/webpack-3/bundle.js b/examples/javascript/dist/webpack-3/bundle.js deleted file mode 100644 index 2d9e545d..00000000 --- a/examples/javascript/dist/webpack-3/bundle.js +++ /dev/null @@ -1,86 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(2);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///./example.js?"); - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n\n//# sourceURL=webpack:///./main.css?"); - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("// This file is used for frontend and backend\n\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 2\n// module chunks = 0\n\n//# sourceURL=webpack:///./universial.js?"); - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/examples/javascript/dist/webpack-3/index.html b/examples/javascript/dist/webpack-3/index.html deleted file mode 100644 index 99d6252c..00000000 --- a/examples/javascript/dist/webpack-3/index.html +++ /dev/null @@ -1,2 +0,0 @@ -Hello World from backend2017-06-24T21:03:19.943Z

Partial

- \ No newline at end of file diff --git a/examples/javascript/dist/webpack-3/styles.css b/examples/javascript/dist/webpack-3/styles.css deleted file mode 100644 index 232a2cdb..00000000 --- a/examples/javascript/dist/webpack-3/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: snow; -} \ No newline at end of file diff --git a/examples/appcache/logo.png b/examples/javascript/dist/webpack-5/55b19870aff2e53d1fb1.png similarity index 100% rename from examples/appcache/logo.png rename to examples/javascript/dist/webpack-5/55b19870aff2e53d1fb1.png diff --git a/examples/javascript/dist/webpack-5/bundle.js b/examples/javascript/dist/webpack-5/bundle.js new file mode 100644 index 00000000..75d23d21 --- /dev/null +++ b/examples/javascript/dist/webpack-5/bundle.js @@ -0,0 +1,84 @@ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 184: +/***/ ((module) => { + +"use strict"; +// This file is used for frontend and backend + + +// If compiled by the html-webpack-plugin +// HTML_WEBPACK_PLUGIN is set to true: +var backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined'; + +module.exports = function () { + return 'Hello World from ' + (backend ? 'backend' : 'frontend'); +}; + + +/***/ }), + +/***/ 636: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ if(__webpack_module_cache__[moduleId]) { +/******/ return __webpack_module_cache__[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +__webpack_require__(636); + +var universal = __webpack_require__(184); +var h1 = document.createElement('h1'); +h1.innerHTML = universal(); + +document.body.appendChild(h1); + +})(); + +/******/ })() +; \ No newline at end of file diff --git a/examples/javascript/dist/webpack-5/index.html b/examples/javascript/dist/webpack-5/index.html new file mode 100644 index 00000000..535cd403 --- /dev/null +++ b/examples/javascript/dist/webpack-5/index.html @@ -0,0 +1 @@ +Hello World from backend2021-10-25T11:10:42.875Z

Partial

\ No newline at end of file diff --git a/examples/javascript/dist/webpack-5/styles.css b/examples/javascript/dist/webpack-5/styles.css new file mode 100644 index 00000000..e86486ba --- /dev/null +++ b/examples/javascript/dist/webpack-5/styles.css @@ -0,0 +1,3 @@ +body { + background: snow; +} diff --git a/examples/javascript/template.js b/examples/javascript/template.js index cbc74163..33ca1b57 100644 --- a/examples/javascript/template.js +++ b/examples/javascript/template.js @@ -1,5 +1,5 @@ // Webpack require: -var partial = require('./partial.html'); +var partial = require('./partial.html').default; var universal = require('./universial.js'); // Export a function / promise / or a string: diff --git a/examples/javascript/webpack.config.js b/examples/javascript/webpack.config.js index d1d3d636..9945c4c5 100644 --- a/examples/javascript/webpack.config.js +++ b/examples/javascript/webpack.config.js @@ -1,27 +1,25 @@ var path = require('path'); var HtmlWebpackPlugin = require('../..'); -var ExtractTextPlugin = require('extract-text-webpack-plugin'); +var MiniCssExtractPlugin = require('mini-css-extract-plugin'); var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; module.exports = { context: __dirname, entry: './example.js', output: { path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion), - publicPath: '', filename: 'bundle.js' }, module: { - loaders: [ - { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, - { test: /\.png$/, loader: 'file-loader' }, + rules: [ + { test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader'] }, + { test: /\.png$/, type: 'asset/resource' }, { test: /\.html$/, loader: 'html-loader' } ] }, - devtool: 'eval', plugins: [ new HtmlWebpackPlugin({ template: 'template.js' }), - new ExtractTextPlugin('styles.css') + new MiniCssExtractPlugin({ filename: 'styles.css' }) ] }; diff --git a/examples/multi-page/dist/webpack-5/first.html b/examples/multi-page/dist/webpack-5/first.html new file mode 100644 index 00000000..930ee6eb --- /dev/null +++ b/examples/multi-page/dist/webpack-5/first.html @@ -0,0 +1 @@ +Webpack App \ No newline at end of file diff --git a/examples/multi-page/dist/webpack-5/first.js b/examples/multi-page/dist/webpack-5/first.js new file mode 100644 index 00000000..6f94dfe5 --- /dev/null +++ b/examples/multi-page/dist/webpack-5/first.js @@ -0,0 +1,478 @@ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 173: +/***/ ((module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(609); +/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__); +// Imports + +var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]}); +// Module +___CSS_LOADER_EXPORT___.push([module.id, "body {\n background: snow;\n}", ""]); +// Exports +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); + + +/***/ }), + +/***/ 609: +/***/ ((module) => { + +"use strict"; + + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +// css base code, injected by the css-loader +// eslint-disable-next-line func-names +module.exports = function (cssWithMappingToString) { + var list = []; // return the list of modules as css string + + list.toString = function toString() { + return this.map(function (item) { + var content = cssWithMappingToString(item); + + if (item[2]) { + return "@media ".concat(item[2], " {").concat(content, "}"); + } + + return content; + }).join(''); + }; // import a list of modules into the list + // eslint-disable-next-line func-names + + + list.i = function (modules, mediaQuery, dedupe) { + if (typeof modules === 'string') { + // eslint-disable-next-line no-param-reassign + modules = [[null, modules, '']]; + } + + var alreadyImportedModules = {}; + + if (dedupe) { + for (var i = 0; i < this.length; i++) { + // eslint-disable-next-line prefer-destructuring + var id = this[i][0]; + + if (id != null) { + alreadyImportedModules[id] = true; + } + } + } + + for (var _i = 0; _i < modules.length; _i++) { + var item = [].concat(modules[_i]); + + if (dedupe && alreadyImportedModules[item[0]]) { + // eslint-disable-next-line no-continue + continue; + } + + if (mediaQuery) { + if (!item[2]) { + item[2] = mediaQuery; + } else { + item[2] = "".concat(mediaQuery, " and ").concat(item[2]); + } + } + + list.push(item); + } + }; + + return list; +}; + +/***/ }), + +/***/ 965: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(62); +/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(173); + + + +var options = {}; + +options.insert = "head"; +options.singleton = false; + +var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* .default */ .Z, options); + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* .default.locals */ .Z.locals || {}); + +/***/ }), + +/***/ 62: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var isOldIE = function isOldIE() { + var memo; + return function memorize() { + if (typeof memo === 'undefined') { + // Test for IE <= 9 as proposed by Browserhacks + // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 + // Tests for existence of standard globals is to allow style-loader + // to operate correctly into non-standard environments + // @see https://github.com/webpack-contrib/style-loader/issues/177 + memo = Boolean(window && document && document.all && !window.atob); + } + + return memo; + }; +}(); + +var getTarget = function getTarget() { + var memo = {}; + return function memorize(target) { + if (typeof memo[target] === 'undefined') { + var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself + + if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { + try { + // This will throw an exception if access to iframe is blocked + // due to cross-origin restrictions + styleTarget = styleTarget.contentDocument.head; + } catch (e) { + // istanbul ignore next + styleTarget = null; + } + } + + memo[target] = styleTarget; + } + + return memo[target]; + }; +}(); + +var stylesInDom = []; + +function getIndexByIdentifier(identifier) { + var result = -1; + + for (var i = 0; i < stylesInDom.length; i++) { + if (stylesInDom[i].identifier === identifier) { + result = i; + break; + } + } + + return result; +} + +function modulesToDom(list, options) { + var idCountMap = {}; + var identifiers = []; + + for (var i = 0; i < list.length; i++) { + var item = list[i]; + var id = options.base ? item[0] + options.base : item[0]; + var count = idCountMap[id] || 0; + var identifier = "".concat(id, " ").concat(count); + idCountMap[id] = count + 1; + var index = getIndexByIdentifier(identifier); + var obj = { + css: item[1], + media: item[2], + sourceMap: item[3] + }; + + if (index !== -1) { + stylesInDom[index].references++; + stylesInDom[index].updater(obj); + } else { + stylesInDom.push({ + identifier: identifier, + updater: addStyle(obj, options), + references: 1 + }); + } + + identifiers.push(identifier); + } + + return identifiers; +} + +function insertStyleElement(options) { + var style = document.createElement('style'); + var attributes = options.attributes || {}; + + if (typeof attributes.nonce === 'undefined') { + var nonce = true ? __webpack_require__.nc : 0; + + if (nonce) { + attributes.nonce = nonce; + } + } + + Object.keys(attributes).forEach(function (key) { + style.setAttribute(key, attributes[key]); + }); + + if (typeof options.insert === 'function') { + options.insert(style); + } else { + var target = getTarget(options.insert || 'head'); + + if (!target) { + throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); + } + + target.appendChild(style); + } + + return style; +} + +function removeStyleElement(style) { + // istanbul ignore if + if (style.parentNode === null) { + return false; + } + + style.parentNode.removeChild(style); +} +/* istanbul ignore next */ + + +var replaceText = function replaceText() { + var textStore = []; + return function replace(index, replacement) { + textStore[index] = replacement; + return textStore.filter(Boolean).join('\n'); + }; +}(); + +function applyToSingletonTag(style, index, remove, obj) { + var css = remove ? '' : obj.media ? "@media ".concat(obj.media, " {").concat(obj.css, "}") : obj.css; // For old IE + + /* istanbul ignore if */ + + if (style.styleSheet) { + style.styleSheet.cssText = replaceText(index, css); + } else { + var cssNode = document.createTextNode(css); + var childNodes = style.childNodes; + + if (childNodes[index]) { + style.removeChild(childNodes[index]); + } + + if (childNodes.length) { + style.insertBefore(cssNode, childNodes[index]); + } else { + style.appendChild(cssNode); + } + } +} + +function applyToTag(style, options, obj) { + var css = obj.css; + var media = obj.media; + var sourceMap = obj.sourceMap; + + if (media) { + style.setAttribute('media', media); + } else { + style.removeAttribute('media'); + } + + if (sourceMap && typeof btoa !== 'undefined') { + css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); + } // For old IE + + /* istanbul ignore if */ + + + if (style.styleSheet) { + style.styleSheet.cssText = css; + } else { + while (style.firstChild) { + style.removeChild(style.firstChild); + } + + style.appendChild(document.createTextNode(css)); + } +} + +var singleton = null; +var singletonCounter = 0; + +function addStyle(obj, options) { + var style; + var update; + var remove; + + if (options.singleton) { + var styleIndex = singletonCounter++; + style = singleton || (singleton = insertStyleElement(options)); + update = applyToSingletonTag.bind(null, style, styleIndex, false); + remove = applyToSingletonTag.bind(null, style, styleIndex, true); + } else { + style = insertStyleElement(options); + update = applyToTag.bind(null, style, options); + + remove = function remove() { + removeStyleElement(style); + }; + } + + update(obj); + return function updateStyle(newObj) { + if (newObj) { + if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) { + return; + } + + update(obj = newObj); + } else { + remove(); + } + }; +} + +module.exports = function (list, options) { + options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of