question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: www folder is missing with ionic react app using cordova plugin

See original GitHub issue

Ionic version: ionic 4.0

Current behavior:

I am trying to create a ionic react app, using my custom cordova plugin. I use https://ionicframework.com/blog/ionic-cli-v5-brings-react-beta-support/ to create the app. After adding cordova plugin and running ionic build/cordova prepare for ios the www folder is empty. compared to ionic react app, if i create app for target angular it fills www folder correctly.

Expected behavior: ionic build/cordova prepare should add desired file including index.html to www folder which is not happening fo rreact-ionic app.

Steps to reproduce: ionic start myApp --type=react ionic cordova plugin list ionic cordova plugin add cordova-plugin-custom => add cordova dependencies ionic cordova platform ios => add www folder but empty ionic cordova build ios ionic cordova prepare ios => www folder is still empty ionic cordova run ios => throws an error saying www/index.html not found.

Other information: If I execute same steps as above except first line as ionic start myApp --type=angular, it shows www folder correctly including index.html and works fine.

Ionic:

Ionic CLI : 5.0.2 (/usr/local/lib/node_modules/ionic) Ionic Framework : @ionic/react 0.0.5

Cordova:

Cordova CLI : 8.1.1 (cordova-lib@8.1.0) Cordova Platforms : ios 4.5.5 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.0, (and 4 other plugins)

Utility:

cordova-res : 0.5.1 native-run : 0.2.7

System:

NodeJS : v8.10.0 (/usr/local/bin/node) npm : 6.9.0 OS : macOS Mojave Xcode : Xcode 10.2.1 Build version 10E1001

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kensodemanncommented, Jan 9, 2020

@stubclan - React builds to a build directory, not a www directory, use set webDir to that in your capacitor.config.json like this:

{
  "appId": "com.kensodemann.myweather",
  "appName": "my-weather-app",
  "bundledWebRuntime": false,
  "npmClient": "npm",
  "webDir": "build",
  "cordova": {}
}
1reaction
SalathielGenesecommented, Jun 26, 2019

Not sure I got here (I mean this page) b/c I had the same issue -10mins. ago.

I fixed it by changing webDir in ./capacitor.config.json from "www" to "build" (to match react build folder)

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: www folder is missing with ionic react app using cordova ...
Ionic version: ionic 4.0 Current behavior: I am trying to create a ionic react app, using my custom cordova plugin.
Read more >
Www folder is missing with ionic react app using cordova plugin
Ionic version: ionic 4.0 Current behavior: I am trying to create a ionic react app, using my custom cordova plugin.
Read more >
Www folder is missing with ionic react app using cordova plugin
Ionic CLI doesn't support Cordova for React, only Capacitor. If you want to use Cordova you'll have to use Cordova CLI commands directly...
Read more >
The 9 Most Common Mistakes That Ionic Developers Make
Common Mistake #6: Trying to Run Cordova Plugins Inside the Browser. The majority of developers using Ionic will want their app to run...
Read more >
cordova-plugin-file
cordova -plugin-file. This plugin implements a File API allowing read/write access to files residing on the device. This plugin is based on several...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found