3

I'm trying to build an app using Webpack and Cordova. I put the contents of my webpack 'dist' folder into my cordova 'www' folder and then I build it for Android and emulate it.

When the app opens I get a lot of 'ERR_FILE_NOT_FOUND' erros, when I open my compiled index.html I see that there is a '/' in front of every link that causes the error because it points to the wrong directory.

Example 'src=/static/js/example.js'

If I remove the first '/' manually and rebuild the app for Android it works.

How do I remove those '/' when I compile my project so I don't have to manually edit every link after compiling?

Example:

It should look for the files in the same folder as the index.html: "file:///android_asset/www/index.html#/"

instead it goes to: 'file:///static/js/example.js'

(The static map is in the same directory as the index.html)

Note: When I open the index.html directly in the browser the links work

1
  • Adding publicPath: '' to the webpack config seemed to have resolved the issue! Commented Dec 21, 2017 at 11:46

1 Answer 1

3

Adding publicPath: '' to the webpack config seemed to have resolved the issue!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.