diff --git a/cordova-lib/src/plugman/prepare.js b/cordova-lib/src/plugman/prepare.js index 961141ed8..6083cbfb4 100644 --- a/cordova-lib/src/plugman/prepare.js +++ b/cordova-lib/src/plugman/prepare.js @@ -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') {