Socket
Socket
Sign inDemoInstall

cordova-plugin-webpack

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-webpack

Cordova Webpack Plugin


Version published
Weekly downloads
145
increased by173.58%
Maintainers
1
Weekly downloads
 
Created
Source

cordova-plugin-webpack

npm version Downloads dependencies Status devDependencies Status Maintainability License contributions welcome

This plugin integrates webpack into your Cordova workflow.

Installation

cordova plugin add cordova-plugin-webpack

Usage

Create the App

$ cordova create cordova-plugin-webpack-example cordova.plugin.webpack.example CordovaPluginWebpackExample
$ cd cordova-plugin-webpack-example

Add Platforms

$ cordova platform add android ios

Add Plugin

$ cordova plugin add cordova-plugin-webpack

Create webpack configuration file

Just create a webpack.config.js file in the project root folder!

webpack.config.js:

const path = require('path');

module.exports = {
  mode: 'development'
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'www'),
    filename: 'index.bundle.js'
  },
  devtool: 'inline-source-map',
};

Specify www folder for output.path property.

Fix HTML file

www/index.html:

# 
-         <script type="text/javascript" src="js/index.js"></script>
+         <script type="text/javascript" src="index.bundle.js"></script>

Build the App

Before preparing your application, it is bundled with webpack.

$ cordova build

Processing flow:

webpack compile > cordova prepare > cordova compile

Live Reload (Hot Module Replacement) the App

$ cordova prepare -- --livereload
$ cordova build -- --livereload
$ cordova run -- --livereload

Processing flow:

webpack compile > cordova prepare > webpack serve > cordova compile

TODO

  • Bundle with webpack before preparing.
  • Live Reload (Hot Module Replacement) with webpack-dev-server.
    • Emulator
    • Device

License

Apache-2.0

Author Information

This plugin was created in 2018 by Kotaro Sugawara.

Keywords

FAQs

Package last updated on 13 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc