Skip to content

Commit

Permalink
Allow plugin modules to be .json files
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-onsip committed Aug 7, 2014
1 parent 190eb20 commit 28b372e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cordova-lib/src/plugman/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_

var fsPath = path.join.apply(path, pathParts);
var scriptContent = fs.readFileSync(path.join(pluginDir, fsPath), 'utf-8').replace(/^\ufeff/, ''); // Window BOM
if (fsPath.match(/.*\.json$/)) {
scriptContent = 'module.exports = ' + scriptContent;
}
scriptContent = 'cordova.define("' + moduleName + '", function(require, exports, module) { ' + scriptContent + '\n});\n';
fs.writeFileSync(path.join(platformPluginsDir, plugin_id, fsPath), scriptContent, 'utf-8');
if(platform == 'wp8' || platform == 'windows8') {
Expand Down

0 comments on commit 28b372e

Please sign in to comment.