Cordova Slack Digest

Wed, 10 Mar 2021 08:35:43 GMT

User count: 4397

Join the conversation at slack.cordova.io

Channel #general (14 messages)


Tue, 09 Mar 2021 10:29:19 GMT

@osaintilien55 says

Im trying to use webpack with my project. I found this plugin (https://www.npmjs.com/package/cordova-plugin-webpack) that I believe I need to make it work. When I paste this cordova plugin add cordova-plugin-webpack (which I got from docs) into terminal directory where my pkg.json file is located I get this error

Failed to fetch plugin cordova-plugin-webpack via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. CordovaError: Error: npm: Command failed with exit code 1 Error output: npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: io.cordova.hellocordova@1.0.0 npm ERR! Found: webpack-cli@4.5.0 npm ERR! node_modules/webpack-cli npm ERR! dev webpack-cli@"^4.5.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer webpack-cli@"^3.0.0" from cordova-plugin-webpack@1.0.5 npm ERR! node_modules/cordova-plugin-webpack npm ERR! dev cordova-plugin-webpack@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Tue, 09 Mar 2021 11:45:36 GMT

@norman137 says

looks like it wants webpack-cli@3 instead of webpack-cli@4

Tue, 09 Mar 2021 11:46:53 GMT

@osaintilien55 says

Oh!! okay I'm actually using webpack5 the latest at the moment. Do you use webpack with cordova?

Tue, 09 Mar 2021 11:47:14 GMT

@norman137 says

I'm not sure why a cordova plugin is required. I use webpack and I just have webpack build to the www/ folder

Tue, 09 Mar 2021 11:47:29 GMT

@norman137 says

webpack is ran before I run the cordova commands.

Tue, 09 Mar 2021 11:48:08 GMT

@osaintilien55 says

oh okay I will try it without the plugin then, just wasn't clear on how to use cordova since I have just incorprated webpack

Tue, 09 Mar 2021 11:48:23 GMT

@osaintilien55 says

or rather how to build I should say

Tue, 09 Mar 2021 11:48:58 GMT

@norman137 says

if you wanted to use the webpack dev server/hot reload stuff, you should also be able to do that by just pointing the cordova <content src> to the webpack dev server url.

Tue, 09 Mar 2021 11:49:19 GMT

@osaintilien55 says

okay will try it out

Tue, 09 Mar 2021 11:52:49 GMT

@norman137 says

If you wanted to use the plugin -- npm install -D webpack@4 webpack-cli@3 webpack-dev-server@3 to install webpack 4

The plugin probably just doesn't support webpack 5.

Tue, 09 Mar 2021 12:20:00 GMT

@osaintilien55 says

right okay

Tue, 09 Mar 2021 15:26:42 GMT

@osaintilien55 says

When cordova build android is executed is there something that can be done to cancel it without having to restart VS?

Tue, 09 Mar 2021 20:14:31 GMT

@osaintilien55 says

Ok so I have just moved package.json, and my node_modules folder outside of my www folder. Afterwards, my webpack run start would not compile until I adjusted these settings to this... contentBase: '../../www/dist', entry: './www/src/index.js', Now everything compiles with no errors, yet when I go to the localhost:8080 I get a blank page with a 404 error GET <http://localhost:8080/> 404 (Not Found) I'm not sure what to mess with to fix this

Tue, 09 Mar 2021 22:46:44 GMT

@kerrydupont says

Anyone using Mapkit JS in a Cordova project? I have one small bug that's beating me: How to make the ‘Legal’ link open in an InAppBrowser, instead of taking over the whole view?