Add a static prefix to urls generated in webpack

后端 未结 1 1189
伪装坚强ぢ
伪装坚强ぢ 2021-02-15 09:13

I want to add a prefix (\"/static/\") to every static url generated by webpack. However I want the generated bundle to ignore this, so app.js and staticfiles all end up in the

相关标签:
1条回答
  • 2021-02-15 09:48

    In webpack.config.js set the publicPath option.

    output: {
        path: "/home/proj/public/assets",
        publicPath: "/static/"
    }
    

    https://github.com/webpack/docs/wiki/configuration#outputpublicpath

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