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

Doesn't inject sources after v4 #1381

Closed
ghost opened this issue Mar 30, 2020 · 8 comments
Closed

Doesn't inject sources after v4 #1381

ghost opened this issue Mar 30, 2020 · 8 comments

Comments

@ghost
Copy link

ghost commented Mar 30, 2020

This is my setting. It doesn't inject sources. It doesn't matter if i inject manually using ejs or using inject true.

template: path.join(`${page.file}.ejs`),
filename: path.join(`${page.file}.html`),
chunks: [page.key],
inject: true,
minify: false,

If i just change the version to 3.0.2 it works.
Something is fucked up again.

Windows 10.

@jantimon
Copy link
Owner

jantimon commented Mar 31, 2020

@cdagli
Copy link

cdagli commented Mar 31, 2020

Same for me, our configuration stopped working after updating v4.x.x. We've reverted back to 3.2.0 and investigating if something wrong with our configuration.

We don't have anything magical, it is just straightforward configuration:

    new HtmlWebpackPlugin({
      template: './src/index.ejs',
    }),

Seems like our issue is related with #1355

@jantimon
Copy link
Owner

@cdagli the issue you mentioned is not related - it is about output filenames

could you please show how you use the css / js inside your index.ejs?

@odrozd
Copy link

odrozd commented Mar 31, 2020

@jantimon having similar issue after upgrading to v4 and working fine in v3
here is config:

 new HtmlWebpackPlugin({
            filename: "../Areas/MVC/Views/WebPackBundles/_ConnectionLoggingBundles.cshtml",
            chunks: ['manifest', 'vendor', 'connection_logging_loader'],
            inject: false,
            template: '_LayoutTemplate.cshtml'
        })

and template

<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
<script src="~/<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
<% } %>

@cdagli
Copy link

cdagli commented Mar 31, 2020

@jantimon Sorry, maybe I got this wrong and our issue is unrelated with this issue but related with #1355 Because it works when we remove the ?[chunkhash] in the output.filename [name].js?[chunkhash]'

@odrozd
Copy link

odrozd commented Mar 31, 2020

just fyi removing [chunkhash] does not work in my case

@jantimon
Copy link
Owner

jantimon commented Apr 1, 2020

The querystring was solved with html-webpack-plugin 4.0.4

In html-webpack-plugin <%= htmlWebpackPlugin.chunks is no longer supported.

More details why that change was made can be found here: #1369 (comment)

I will try to provide a new way but it will take me some time as I can do that only in my spare time.

So unfortunately for now you have to use html-webpack-plugin 3.2 for now if you rely on <%= htmlWebpackPlugin.chunks.

@jantimon
Copy link
Owner

jantimon commented Apr 1, 2020

Closing as it is a duplicate of #1369

@jantimon jantimon closed this as completed Apr 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
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

3 participants