Reputation: 98
I'm building a normal App (JQuery, ES6, etc) with webpack and it's usual loaders. I came across the following situation:
The problem is, when I am in production I will need to add a
<link href="some-bundle.css" />
to my index.html
. OK. But by doing this, back in development I would get a 404 every time, since my css is not coming from any external source (It comes from JS and it's inline thing).
And if I don't add the link tag, i'm never getting the compiled stylesheet.
So, how do you do this? Is there any loader to auto add the <link>
in production? Or you just manually add It later on?
Thanks, []s
Upvotes: 1
Views: 91
Reputation: 2851
You could use HTML Webpack Plugin to generate index.html files based on your Webpack build (dev/prod). One would include the link
tag, another would not.
Upvotes: 1