Add a static prefix to urls generated in webpack

后端 未结 1 616
温柔的废话
温柔的废话 2021-02-15 09:40

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:43

    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)
提交回复
热议问题