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

Version 3.0 #558

Closed
jantimon opened this issue Jan 23, 2017 · 27 comments
Closed

Version 3.0 #558

jantimon opened this issue Jan 23, 2017 · 27 comments

Comments

@jantimon
Copy link
Owner

jantimon commented Jan 23, 2017

At all contributors
@SpaceK33z, @SimenB, @numical, @kennyt, @okhomenko, @cgreening, @anjianshi, @mistadikay, @mc-zone, @JSteunou, @spuf, @vincentngthu, @NekR, @mateatslc, @chiplay, @ascariandrea, @graingert, @zzuieliyaoli, @foglerek, @sandeep45, @koenpunt, @sokra, @shprink, @cesarandreu, @oliviertassinari, @sebastienbarre, @jamesjieye, @AndrewRayCode, @kurtharriger, @ai, @PeachScript, @kinday, @TalAter, @chrillo, @timoxley, @insin, @adjohnson916, @Madalosso, @mgol, @victorwpbastos, @pburtchaell, @dtinth, @yyx990803, @michael-wolfenden, @denis-sokolov, @jirikolarik, @jpetitcolas, @ruehl, @Foxandxss, @creeperyang, @vyorkin, @thomasguillory, @tlrobinson, @nartamonov

I am planning to move the webpack-html-plugin forward to 3.0 and would like to gather your input which (breaking-)changes you would like to see

Planed changes:

  • Use stats.entrypoints to determine which links/scripts should be added to the html. (Unfortunately this will stop the support for webpack 1 as @sokra won't port this feature back into webpack 1)
  • Finally jump up some node versions to node 4 (the official supported version for webpack 2)
  • Remove type: 'text/javascript'
  • Remove html minifcation (could still be done by a plugin if needed)
  • Remove chunksSortMode (as stats.entrypoints are already sorted)

Open for discussion:

  • Switch to ava
  • Generate multiple html files (e.g. by using [name] as output name)
@graingert
Copy link
Contributor

these changes won't break my build.

@SpaceK33z
Copy link
Contributor

SpaceK33z commented Jan 23, 2017

Sounds like good changes, I agree with all of them 👍 . Let me know if you need any help with the changes, I might have some time next week.

@victorwpbastos
Copy link
Contributor

victorwpbastos commented Jan 23, 2017 via email

@TheLarkInn
Copy link
Collaborator

Would you consider discussion around migrating repo to github.com/webpack-contrib org?

@pburtchaell
Copy link

pburtchaell commented Jan 24, 2017

None of the changes will affect me. 👍

Remove type: 'text/javascript

This was added via #311 (original issue: #309). As it turns out, the issue I originally reported was caused by the font-feature-settings CSS property. If you use that property on Safari, it breaks the page entirely. So, unless there was another reason why this was added, I think we can remove it.

@vincent-ng
Copy link
Contributor

I'm looking forward to the feature of generating multiple html files. 👍

@creeperyang
Copy link
Contributor

Generate multiple html files is a good feature!

Include it with v3 😄

@NekR
Copy link
Contributor

NekR commented Jan 24, 2017

You know that you can generate multi html files by using multiple instances of HtmlWebpackPlugin, right?

@creeperyang
Copy link
Contributor

Sure. I think it's not elegant if you using ten instances for ten pages. (Although you can use something like Array.map). Support multiple pages with one instance is great.

@SimenB
Copy link
Contributor

SimenB commented Jan 24, 2017

Only thing there that I'd need to make changes for is minifying, and I wholly support making a separate plugin for it. So 👍 from me! 😄
A change you could consider is dropping Bluebird for native promises. That would break my plugin (http://npm.im/add-asset-html-webpack-plugin), but I can just wrap it in Bluebird on my side (as I need the ordered iteration it provides).

@mc-zone
Copy link
Contributor

mc-zone commented Jan 24, 2017

How about isomorphic support?

I've been looking for an elegant solution about template reusability when I use server-rendering.

Like the following (A rough example):

A common template :

template.ejs

<!DOCTYPE html>
<html lang="en">
<head>
  <title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
  
<!-- Use a special format to pass server-rendering data? -->
<!--{{ serverRenderingData.body }} --> 

<script src="<%= htmlWebpackPlugin.files.chunks.app.entry %>"></script>
</body>
</html>

2(kinds of) files are generated :

  • template.html (HTML file)
<!DOCTYPE html>
<html lang="en">
<head>
  <title>title</title>
</head>
<body>
  

<script src="//example.com/publicPath/app.bundle.js"></script>
</body>
</html>
  • template.js (CommonJS module to be required on Node)**
module.exports = function(serverRenderingData){
  return `
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>title</title>
    </head>
    <body>
      
    ${serverRenderingData.body}

    <script src="//example.com/publicPath/app.bundle.js"></script>
    </body>
    </html>
  `
};

Anyone has better practice? or any suggestion?

@JSteunou
Copy link
Contributor

I'm 👍 with all those changes as you are following semver so the impact can be managed easily. Thank you for including us in the discussion!

@spuf
Copy link
Contributor

spuf commented Jan 24, 2017

Switch to ava

jest?

@jantimon
Copy link
Owner Author

thanks for all your feedback 👍

@spuf ava has build in support for async even for node 4 - any reasons to use jest instead?
@mc-zone this is already possible (in a way) since 2.0 - feel free to open a issue / stack overflow question
@SimenB yes - I guess it would be appropriate to drop bluebird
@TheLarkInn open for a discussion in slack
@SpaceK33z thanks - help is always appreciated

@graingert
Copy link
Contributor

@TheLarkInn probably a separate topic to V3.0: #565

@numical
Copy link
Contributor

numical commented Jan 29, 2017

Hi, if you choose to support multiple html files, can you ensure your events API supports this - don't know what mechanism you will choose but, e.g., ensure you pass through the entry point for that html file.
(To be honest, the current approach where you have a separate instance for each page might appear clunky but actually works quite well alongside separate instances of related plugins such as ExtractText etc).

@jantimon jantimon mentioned this issue Jan 29, 2017
@jantimon
Copy link
Owner Author

@numical I'll try to keep it in my mind ;)

@darylteo
Copy link

darylteo commented Feb 1, 2017

WRT generating multiple files: I'm working with a static site generator (metalsmith) and using html-webpack-plugin to generate injected assets. However, because pages can be added or removed at "devtime", the plugin does not pick up these new files, requiring a full rebuild just to pick up the new file.

Not sure what can be done here, but just chipping in. A single instance of the plugin that takes a glob and watches for changes may justify it as an enhancement.

@Disorrder
Copy link

+1 waiting for entrypoints and several files. Good for building multipage applications!

@TheLarkInn
Copy link
Collaborator

If you are looking for a workaround for the whole multipage I have something that wraps this plugin github.com/mutualofomaha/multipage-webpack-plugin that might help

@airtonix
Copy link

removing chunkSortMode is generally going to be a BadIdea(tm). stats.entrypoints is rarely in the order some people may want... I know it definitely won't be in my case.

I'm currently having to use this snippet to make sure my bits are properly sorted: #481 (comment)

@var-bp
Copy link

var-bp commented May 11, 2017

please make dynamic entrypoints, for example:

const path = require('path');
const glob = require('glob');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const config = {};

glob.sync(`${basePath}/src/layouts/*.?(pug|jade)`).forEach((item) => {
  config.plugins.push(
    new HtmlWebpackPlugin({
      filename: `${path.basename(item, path.extname(item))}.html`,
      template: item
    })
});

module.exports = config;

@princemaple
Copy link

Hi @jantimon will these be addressed soon? Now that 3.0 is out.

@Benno007
Copy link

Might be a good idea to remove chunkSortMode as an option from the documentation for version 3?

@edmorley
Copy link
Contributor

edmorley commented Jul 5, 2018

Remove html minifcation (could still be done by a plugin if needed)

Is this going to be done for v4?

@jantimon
Copy link
Owner Author

Because of the webpack 4 release those changes were postponed to html-webpack-plugin 4

Almost all features described above are implemented in #953

And are already published as alpha to npm:

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

@lock
Copy link

lock bot commented Oct 11, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests