Html-webpack-plugin: Building assets for Cordova application

Created on 9 Nov 2016  路  3Comments  路  Source: jantimon/html-webpack-plugin

Hi guys,

I'm using html-webpack-plugin for injecting built sources into index.html file.
But, since I'm building an application under Cordova, it need to be added without trailing slash at beginning.

How can it be achieved?

Here is my configuration for plugin:

new HtmlWebpackPlugin({
  template: './src/public/index.html',
  chunksSortMode: 'dependency'
}),

It results into this HTML:

<script type="text/javascript" src="/js/polyfills.e2cf4996bb91076c61e3.js"></script>
<script type="text/javascript" src="/js/vendor.e2cf4996bb91076c61e3.js"></script>
<script type="text/javascript" src="/js/app.e2cf4996bb91076c61e3.js"></script>

But I need to get without trailing slash.

Thanks for your response.

Most helpful comment

I've found a solution. You need to change publicPath in Webpack config to '' and change <base href="/"> in index.html to <base href="./">.

All 3 comments

cc @jantimon

I've found a solution. You need to change publicPath in Webpack config to '' and change <base href="/"> in index.html to <base href="./">.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

azat-io picture azat-io  路  4Comments

klinki picture klinki  路  3Comments

maxcnunes picture maxcnunes  路  4Comments

lcxfs1991 picture lcxfs1991  路  4Comments

lonelydatum picture lonelydatum  路  3Comments