webpack require relative image

后端 未结 1 1138
后悔当初
后悔当初 2020-12-15 04:57

I have two files:

  • ./img/mypic.png
  • ./js/help/targets/target.js

In target.js:



        
相关标签:
1条回答
  • 2020-12-15 05:37

    The trick is to give webpack a config-hint on what to base its paths on:

    Use:

    "output": { "publicPath": "/" }
    

    To tell webpack not to be relative.

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