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

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

Open
isaacl opened this issue Nov 1, 2020 · 4 comments
Open

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

isaacl opened this issue Nov 1, 2020 · 4 comments

Comments

@isaacl
Copy link

isaacl commented Nov 1, 2020

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>
@terox
Copy link

terox commented Nov 2, 2020

Hello!

I am experimenting the same issue in this repo.

Related: webpack-contrib/html-loader#329

@isaacl
Copy link
Author

isaacl commented Nov 2, 2020

@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

@terox
Copy link

terox commented Jan 12, 2021

@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

@isaacl
Copy link
Author

isaacl commented Jan 19, 2021

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants