How to include raw static html file into another html file with webpack

后端 未结 2 446
孤城傲影
孤城傲影 2020-12-21 16:54

I have a header.html file

And I have an

相关标签:
2条回答
  • 2020-12-21 17:17

    Note that the interpolate option was removed in html-loader v1.0.0. The solution works with html-loader v0.5.5 and ${require('./header.html')}

    0 讨论(0)
  • 2020-12-21 17:40

    EDIT: This answer is not valid anymore with html-loader > 0.5.5

    You need to enable interpolation like this:

      module: {
        rules: [
          {
            test: /\.html$/,
            use: {
              loader: 'html-loader',
              options: {
                interpolate: true
              }
            }
          }
        ]
      },
    

    Source for my answer, this question/answer.

    0 讨论(0)
提交回复
热议问题