Socket
Socket
Sign inDemoInstall

cordova-plugin-webpack

Package Overview
Dependencies
525
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.1.0

.eslintignore

96

package.json
{
"name": "cordova-plugin-webpack",
"version": "0.0.2",
"version": "0.1.0",
"description": "Cordova Webpack Plugin",

@@ -14,6 +14,9 @@ "cordova": {

"scripts": {
"upgrade-interactive": "npm-check --update",
"precommit": "lint-staged",
"prepare": "npm run build",
"build": "rimraf scripts/* && babili src --out-dir scripts",
"lint": "eslint 'scripts/**/*.js'"
"build": "rimraf scripts/* && tsc && webpack",
"lint": "eslint '**/*.{js,ts}'",
"lint:fix": "npm run lint -- --fix",
"commit": "commit"
},

@@ -39,55 +42,54 @@ "repository": {

"dependencies": {
"webpack": "^4.6.0"
"@types/elementtree": "^0.1.0",
"@types/node": "^12.0.0",
"@types/webpack": "^4.4.31",
"@types/webpack-dev-server": "^3.1.5",
"cordova-common": "^3.1.0",
"csp-parse": "0.0.2",
"current-device": "^0.8.0",
"elementtree": "^0.1.7",
"express": "^4.16.4",
"glob": "^7.1.4",
"source-map-support": "^0.5.12",
"webpack": "^4.31.0",
"webpack-dev-server": "^3.3.1",
"webpack-inject-plugin": "^1.5.0"
},
"devDependencies": {
"babel-preset-env": "^1.6.1",
"babili": "^0.1.4",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"@commitlint/cli": "^7.6.0",
"@commitlint/config-conventional": "^7.6.0",
"@commitlint/prompt-cli": "^7.6.1",
"@typescript-eslint/eslint-plugin": "^1.7.0",
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-react": "^7.7.0",
"husky": "^0.14.3",
"lint-staged": "^7.0.5",
"prettier": "^1.12.1",
"rimraf": "^2.6.2"
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-prettier": "^3.0.1",
"husky": "^2.2.0",
"lint-staged": "^8.1.6",
"npm-check": "^5.9.0",
"prettier": "^1.17.0",
"rimraf": "^2.6.3",
"ts-loader": "^6.0.0",
"typescript": "^3.4.5",
"webpack-cli": "^3.3.2"
},
"babel": {
"presets": [
[
"env",
{
"targets": {
"node": "4.2.0"
}
}
]
]
},
"eslintConfig": {
"extends": [
"airbnb",
"prettier"
],
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": [
"error",
{
"singleQuote": true,
"trailingComma": "es5"
}
]
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"scripts/**/*.js": [
"npm run lint -- --fix",
"git add"
"linters": {
"*.{js,ts}": [
"npm run lint:fix",
"git add"
]
},
"ignore": [
"node_modules/**",
"scripts/**"
]
}
}

@@ -9,3 +9,3 @@ # cordova-plugin-webpack

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/dwyl/esta/issues)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/kotarella1110/cordova-plugin-webpack/issues)

@@ -16,22 +16,33 @@ This plugin integrates [webpack](https://webpack.js.org "webpack") into your Cordova workflow.

```
```shell
cordova plugin add cordova-plugin-webpack
```
You can bundle using webpack you installed.
By default, the this plugin's webpack is used.
## Usage
### Create the App
```shell
$ cordova create cordova-plugin-webpack-example cordova.plugin.webpack.example CordovaPluginWebpackExample
$ cd cordova-plugin-webpack-example
```
npm install webpack
cordova plugin add cordova-plugin-webpack
### Add Platforms
```shell
$ cordova platform add android ios
```
## Usage
### Add Plugin
**Just create _webpack.config.js_ file in project root!**
```shell
$ cordova plugin add cordova-plugin-webpack
```
Example:
### Create webpack configuration file
_webpack.config.js_
**Just create a `webpack.config.js` file in the project root folder!**
`webpack.config.js`:
```js

@@ -41,7 +52,9 @@ const path = require('path');

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

@@ -52,15 +65,42 @@ ```

### Fix HTML file
`www/index.html`:
```diff
#
- <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.
※ Specifically, to be bundlled before executing the following cordova commands.
```
$ cordova build
```
- `cordova prepare`
- `cordova platform add`
- `cordova build`
- `cordova run`
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
- [x] Bundle with webpack before preparing.
- [ ] Live Reload (Hot Module Replacement) with webpack-dev-server.
- [x] Live Reload (Hot Module Replacement) with webpack-dev-server.
- [x] Emulator
- [ ] Device

@@ -73,2 +113,2 @@ ## License

This plugin was created in 2018 by Kotaro Sugawara.
This plugin was created in 2018 by Kotaro Sugawara.

@@ -1,1 +0,33 @@

const path=require('path'),webpack=require('./vendor/webpack');module.exports=(a)=>{const b=a.requireCordovaModule('q').defer(),c=path.resolve(a.opts.projectRoot,'webpack.config.js'),d=require(c),e=webpack(d);return e.run((a,c)=>{a&&b.reject(a),console.log(c.toString({chunks:!1,colors:!0})),b.resolve()}),b.promise};
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
require("source-map-support/register");
var path = __importStar(require("path"));
var webpack_1 = __importDefault(require("webpack"));
module.exports = function (ctx) {
return new Promise(function (resolve, reject) {
var webpackConfigPath = path.resolve(ctx.opts.projectRoot, 'webpack.config.js');
var webpackConfig = require(webpackConfigPath);
var compiler = webpack_1.default(webpackConfig);
compiler.run(function (err, stats) {
if (err) {
reject(err);
}
console.log(stats.toString({
chunks: false,
colors: true,
}));
resolve();
});
});
};
//# sourceMappingURL=webpackCompile.js.map

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc