Jhipster4, Angular2: How include static image in html

末鹿安然 提交于 2019-12-02 11:45:38

This issue was related to version of generator-jhispter (the version was 4.0.8 for my case), where webpack config wasn't set properly.

After upgrade of generator-jhipster (it's 4.3.0) the issue has gone off. As I understood this issue also might will be fixed if you change in webpack.common.js next rule

{
   test: /\.html$/,
   loader: 'raw-loader',
   exclude: ['./src/main/webapp/index.html']
},

New version of generated project brought me the next:

{
  test: /\.html$/,
  loader: 'html-loader',
  options: {
       minimize: true,
       caseSensitive: true,
       removeAttributeQuotes:false,
       minifyJS:false,
       minifyCSS:false
   },
   exclude: ['./src/main/webapp/index.html']
},

And also you have to check out there is 'html-loader' in our devDependencies of package.json.

And now tag <img src="../../../content/images/staticimage.jpg"> works properly.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!