1

Currently, I know this:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
    <link href="css/main.css" rel="stylesheet"></head>
  </head>
  <body>
  <div id="app">
  </div>
  <script type="text/javascript" src="js/main.js"></script></body>
</html>

I want the script and css tags injected like:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
    <link href="http://cdn.foo.com/css/main.css" rel="stylesheet"></head>
  </head>
  <body>
  <div id="app">
  </div>
  <script type="text/javascript" src="http://cdn.foo.com/js/main.js"></script></body>
</html>

The others keep the same. i.e.(output files may be saved locally as usual)

1 Answer 1

0

Seems no options. I inject several lines to the source code and solve this problem by:

  new HtmlWebpackPlugin({
    prefix: 'http://cdn.foo.com',
  })

These lines are totally harmless if you don't set prefix option(actually seems harmless even if you set it). More info check this pr.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.