colbyfayock / html-webpack-partials-plugin

🛠 Easy HTML partials for Webpack without a custom index!
MIT License
68 stars 20 forks source link

meta charset priority not respected in production build #18

Open dvarrazzo opened 4 years ago

dvarrazzo commented 4 years ago

I have an index.html containing:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

and the webpack config uses:

    new HtmlWebpackPartialsPlugin({
      path: './src/analytics.html',
      location: 'head',
      priority: 'high',
      options: {ga_property_id: 'UA-172517233-1'},
    }),

to inject analytics. In the dev server I see the meta tag taking precedence:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8"><script async src="...

but the production build the script is pushed before the meta tag: see https://codice.lieve.info/

<!doctype html><html><head><script async src=...</script><meta charset="utf-8">

Plugin version is 0.5.6.

colbyfayock commented 4 years ago

@dvarrazzo is this available on a branch that i can check out locally and reproduce?

dvarrazzo commented 4 years ago

Sure, the repos in the first link should be public: https://github.com/codice-lieve/codice.lieve.info

npm start serves a correctly injected page, npm run build builds a defective page in the dist dir.

colbyfayock commented 4 years ago

Ah okay, maybe I'm crazy but I wasn't seeing this plugin in there yesterday 🤦‍♂️ i'll check this out sometime this weekend for ya

dvarrazzo commented 4 years ago

Ah okay, maybe I'm crazy but I wasn't seeing this plugin in there yesterday

No you are right: apologies but I used the wrong permalinks and pointed to a commit that didn't have the plugin yet. Permalink fixed in case master evolves to something else.