Framework7 lastest version and cordova, now trying to load external js scripts in index.html fail to load

I am trying to load my external local script that are inside my src/assets/ folder but the js scripts are not being loaded, there is no error in the compilation for Cordova,
if I inspect my view source while running Cordova IOS I see my local external js inside my src/ assets/ folder are not being loaded:

Here a screen shot:

27|690x315

inside my index.html I have

...
  <meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: content:">
...

...
  <% if (process.env.TARGET === 'cordova') { %>
  <script src="cordova.js"></script>
  <% } %>
  <!-- built script files will be auto injected -->
  <script src="assets/circulus/js/Draggable.min.js"></script>
  <script src='assets/circulus/js/circulus.js'></script>
</body>
</html>

My Cordova Plugins installed:

is this because Webpack during installation?

I run this in the console to build cordova ios www folder:
npm run build-dev-cordova-ios
cordova run ios

previously I was not having this issue to load my local scripts!
any ideas?

ios don’t have asset folder, try put yours js files in src folder and use this:

  <script src="Draggable.min.js"></script>
  <script src='circulus.js'></script>

but… it bad way, best way use import export


1 Like

thank you! but I know iOS does not have assets folder but I created this assets folder in previous versions of F7 and worked, now after I run npm run build-dev-cordova-ios
and create a www folder inside Cordova, the path to the js files is not loaded…

assets folder it is inside my src/ folder… that is why I do not see what is the problem…
this happens also with autocomplete url: cannot find the files anymore…

:frowning:

1 Like

If you use webpack, it will copy ONLY those assets to result folder that has correct reference, e.g. included with import. Otherwise put them in static/ folder, static folder will be fully copied

2 Likes

Thanks for this useful tip. Works fine :kissing_heart:

solution in this video.

2 Likes