Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html-webpack-plugin 4.x - Switching to Webpack 4 api #953

Merged
merged 55 commits into from
Oct 15, 2018
Merged

Conversation

jantimon
Copy link
Owner

@jantimon jantimon commented May 21, 2018

Bug Fixes

  • chunksorter: Don't sort chunks by default (22fb03f)
  • loader: switch to loaderUtils.getOptions (a0a0f0d)
  • tests: Upgrade webpack-recompilation-simulator (dfe1d10)
  • Add dependencies from the child compilation to the main compilation (27c3e72)
  • Ignore foreign child compilers (1422664)
  • Improve perfomance for appcache files (b94e043)
  • Prevent chunks from beeing added multiple times (d65b37d)
  • Remove compilation.getStats() call for performance reasons (7005a55)
  • Update lodash to 4.17.10 (cc3bf49)

Code Refactoring

  • Change the structure of the internal assets object (37db086)
  • Changed hook names and arguments - the hook order is 'beforeAssetTagGeneration', 'alterAssetTags', 'alterAssetTagGroups', 'afterTemplateExecution', 'beforeEmit', 'afterEmit' (14b4456)
  • Drop support for Webpack 1-3 to use Webpack 4 apis (47efdea)

Features

  • Add default viewport meta tag for default template (302e39e), closes #897 #978
  • hooks: Add a helper for easier hook access (b6dec4b)
  • Add support for the [contenthash] placeholder inside htm file names (ae8233a)
  • Export major version of this plugin (6ae6f48)
  • Remove selfClosingTag (5d3d8e4)
  • Remove type="text/javascript" from injected script tags (b46bf67)
  • Replace jade with pug in examples (d7ec407)
  • Simplify element and charset attribute (55313be)
  • support ES6 template string in default loader (d6b65dd), closes #950
  • compiler: Add file dependencies (bbc07a3)
  • compiler: Use a single compiler for multiple plugin instances (f29ae88)
  • Switch from jasmine to jest (ae1f435)
  • Use jsdoc for static typing (a6b8d2d)
  • Use webpack 4 entries api to extract asset information (342867e)
  • compiler: Use timestamps to verify cache validity (0ebcd17)
  • hooks: Provide static getHook method for access to all html-webpack-plugin hooks (#995) (82b34a1)
  • html-tags: Add a helper to create html-tags (ee6a165)

BREAKING CHANGES

  • Renamed beforeHtmlGeneration hook to beforeAssetTagGeneration
  • loader: switch to loaderUtils getOptions
  • Renamed afterHtmlProcessing hook to beforeEmit
  • The default template has now a predefined viewport meta tag
  • hooks: The html-webpack-plugin doesn't add its hooks to the compilation object anymore
  • Pass the entry point names to the custom sort function instead of chunk objects. Removed the alterhtmlWebpackPluginAlterChunks hook. Changed the structure of the assets argument for all hooks.
  • 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}
  • Renamed beforeHtmlProcessing hook to alterAssetTags
  • 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
  • The default meta utf-8 declaration was changed to

New Event names

Performance improvements

Performance findings by different users for v4:

Copy link

@mohsen1 mohsen1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! enabling the strict mode is not far

typings.d.ts Show resolved Hide resolved
lib/html-tags.js Outdated
*/

/**
* @type {string[]} - All html tag elements which must not contain innerHTML
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let typescript infer types if it can

lib/html-tags.js Outdated

/**
* Turn a tag definition into a html string
* @param tagDefinition {HtmlTagObject}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

order is wrong. types come first

/// <reference path="../typings.d.ts" />
/* eslint-enable */
/*
* @file
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To use JSDoc directives use JSDoc comment sections that start with /**

@jantimon jantimon force-pushed the webpack-4 branch 2 times, most recently from c1e57b5 to 1eb2575 Compare May 22, 2018 12:16
@jantimon
Copy link
Owner Author

Thanks for your fast and detailed feedback!
I managed to turn on typescripts strict mode (except noImplicitAny because of external dependencies like webpack)

@jantimon
Copy link
Owner Author

Released as alpha: https://www.npmjs.com/package/html-webpack-plugin/v/4.0.0-alpha

npm i html-webpack-plugin@next

jantimon and others added 13 commits June 3, 2018 13:27
BREAKING CHANGE: switch to loaderUtils getOptions
BREAKING CHANGE: Chunks aren't sorted anymore by default
BREAKING CHANGE: Template variable webpack was removed
BREAKING CHANGE: Dropped support for Webpack 1 - 3
Only transpile EJS style `<%= name %>`, Close #950

BREAKING CHANGE: Template strings inside templates are now disabled by default
BREAKING CHANGE: Remove selfClosingTag attribute
See https://www.w3.org/TR/html5/scripting-1.html#attr-script-type “The default, which is used if the attribute is absent, is "text/javascript"”

BREAKING CHANGE: The mimetype information "text/javascript" is removed from all generated script
tags
See https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Obsolete_things_to_avoid

BREAKING CHANGE: The default meta utf-8 declaration was changed to <meta charset="utf-8"/>
@jantimon
Copy link
Owner Author

Released as 4.0.0-beta.1

@edmorley
Copy link
Contributor

Hi! Thank you for preparing a new release. However it doesn't appear to be published/public?

$ yarn info html-webpack-plugin versions | grep '4.0.0'
  '4.0.0-alpha',
  '4.0.0-alpha.1',
  '4.0.0-alpha.2' ]

@edmorley
Copy link
Contributor

Is available now - thank you :-)

sibiraj-s and others added 2 commits October 8, 2018 14:26
- types packages should not be installed for plugin users
- adjusted bundles to current webpack@4 behavior
@jantimon jantimon merged commit 7fb656a into master Oct 15, 2018
@jantimon
Copy link
Owner Author

Merged and released as [email protected].

This version is also the release candidate.
I am planing to release it at the end of October.

@Saravanan90
Copy link

Waiting for 4.0.0 release @jantimon

@jantimon
Copy link
Owner Author

Hey @Saravanan90 so far feedback is quite good.

I would love to solve #1089 #1091 and #1072 before we release it as stable 4.x

@Saravanan90
Copy link

Eagerly awaiting for 4.x stable release ❤️ Any ETA? 👀 @jantimon

@lock lock bot locked as resolved and limited conversation to collaborators Dec 20, 2018
@jantimon jantimon deleted the webpack-4 branch January 2, 2020 11:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using es6 template string break the html file build