0.1.6 • Published 10 years ago
webpack-cordova-plugin v0.1.6
webpack-cordova-plugin
Output webpack to a Cordova app.
Usage
var CordovaPlugin = require('webpack-cordova-plugin');
new CordovaPlugin({
config: 'config.xml', // Location of Cordova' config.xml (will be created if not found)
src: 'index.html', // Set entry-point of cordova in config.xml
platform: 'ios', (or 'android') // Set `webpack-dev-server` to correct `contentBase` to use Cordova plugins.
version: true, // Set config.xml' version. (true = use version from package.json)
});Getting started
Install
cordovaand thewebpack-cordova-pluginnpm install -g cordova npm install --save-dev webpack-cordova-pluginAdd the plugin to your
webpack.config.jsRun
webpack. It wil automatically create the Cordovaconfig.xml.Modify the app bundle ID in
config.xmlLaunch cordova!
cordova platforms add ios # or android cordova run ios
Load Cordova
In order for Cordova to load correctly, your index.html must explictly refer to the cordova.js script.
Create an
index.htmland make sure this is copied to your output:require('file?name=index.html!./index.html');Include the
cordova.jsscript in your index.html:<script type="text/javascript" src="cordova.js"></script>
Under the hood
--output-pathis set to the correctwwwdirectory.cordova.jsis declared as external.cordova.jsis loaded as script.config.xmlis updated (version and entry-point)--content-baseis updated to the correct platform (e.g./platforms/android/assets/www)
Changelog
0.1.3 (31/10/2014)
- Enabled
platformconfiguration and commandline option to set correct content base of dev server. - Cordova is installed in
process.cwd()rather than thecontext.
0.1.2 (06/08/2014)
- added
wwwas required cordova directory
0.1.1 (05/08/2014)
- Added
script-loaderas peer dependency.