extract-loader icon indicating copy to clipboard operation
extract-loader copied to clipboard

Generating "[object Object]" for placeholders...

Open isaacl opened this issue 5 years ago • 4 comments

I'm hitting a weird bug w/ html-loader, possibly related to webpack 5? Any ideas/suggestions?

Thanks! -Isaac

Test repo

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="./index.scss" />
  </head>
  <body>
    <script src="./index.js" />
    Hio
  </body>
</html>

output:

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="[object Object]" />
  </head>
  <body>
    <script src="[object Object]" />
    Hio
  </body>
</html>

isaacl avatar Nov 01 '20 03:11 isaacl

Hello!

I am experimenting the same issue in this repo.

Related: https://github.com/webpack-contrib/html-loader/issues/329

terox avatar Nov 02 '20 08:11 terox

@terox I had two issues in my package.

  1. extract-loader does NOT handle script src properly. Solution: use absolute links to make html-loader ignore them, or turn them off in html-loader options
  2. You cannot combine extract-loader with minicssplugin.

Here's my current config, which works. https://gist.github.com/isaacl/64f689595ad5fb959b0565cc50514ae2

I also wrote this hacky script to fix the script tag manually post-build: https://gist.github.com/isaacl/7f8f3855c151f7fb21d8213b9cbde1ac

isaacl avatar Nov 02 '20 14:11 isaacl

@isaacl I updated my master branch with a couple of useful PR from the main project that fix this issue and alises: https://github.com/terox/extract-loader

terox avatar Jan 12 '21 17:01 terox

@terox This project just wasn't maintained well enough for me. So I moved on to rollup, which had better support, and then I moved again to vite, which I think has the best current tooling and support.

isaacl avatar Jan 19 '21 13:01 isaacl