jantimon / html-webpack-plugin

Simplifies creation of HTML files to serve your webpack bundles
MIT License
10.72k stars 1.31k forks source link

How to use alias in <%= require('html-loader!./partial.html').default %>? #1849

Closed chishuix closed 4 months ago

chishuix commented 7 months ago

I configured the following alias

  resolve: {
    alias: {
      // ...
      "components": path.resolve(__dirname, "./src/common/components"),
    }
  },

But when I use it as follows, I get a Can't resolve ... error .

<%= require('html-loader!components/partial.html').default %>
<%= require('html-loader!~components/partial.html').default %>
<%= require('html-loader!@components/partial.html').default %>

So, how do I use aliases here? Thx.

alexander-akait commented 4 months ago

Thank you for creating this issue. However, issues need to follow one of our templates so that we can clearly understand your particular circumstances.

Please help us help you by recreating the issue using one of our templates.