Closed peter-mouland closed 8 years ago
have you been able to confirm this issue?
Hi Peter, due to ongoing health problems I will unable to look at this for a few weeks at least. however, please seek guidance from the many other debowerify contributors
On 30 Apr 2015, at 9:14 pm, Peter Mouland notifications@github.com wrote:
have you been able to confirm this issue?
— Reply to this email directly or view it on GitHub.
hey, any other contributors see this issue?
any contributor able to spend 15mins forking my test, going through the readme and confirming/throwing out my issue?
Can we assume this project is to be considered surpluss to requirements? I'm am deleting my example app as it has been 6 months without anyone taking a peek.
readme.md
Adding debowerify transform into build.js means the app.js bundle no longer excludes the
external
files
node ./build.js
node ./build.js
package.json
{
"name": "tester",
"version": "0.0.0",
"description": "Example package.json. Feel free to copy!",
"main": "src/scripts/tester.js",
"scripts": {
"build-vendor": "browserify -t debowerify -e node_modules/d3/d3.js -e bower_components/dom-delegate/lib/delegate.js -o _site/scripts/cli.vendor.js",
"build": "browserify -t debowerify -r ./src/scripts/app.js -x node_modules/d3/d3.js -x bower_components/dom-delegate/lib/delegate.js -o _site/scripts/cli.app.js"
},
"devDependencies": {
"browserify": "^9.0.3",
"d3": "^3.5.5",
"debowerify": "^1.2.0",
"watchify": "^2.6.2"
}
}
bower.json
{
"name": "tester",
"description": "tester",
"main": "src/scripts/tester.js",
"ignore": [
"**/*",
"!src/**/*"
],
"dependencies": {
"dom-delegate": "~2.0.3"
}
}
build.js
var browserify = require('browserify');
var debowerify = require('debowerify');
var path = require('path');
var fs = require('fs');
var vendorBundle = [
{file:'./bower_components/dom-delegate/lib/delegate.js', expose:'dom-delegate'},
'd3'
]
function Browserify(location, destination, options){
this.location = location;
this.destination = destination;
this.buildApp();
this.buildVendor();
}
Browserify.prototype.buildVendor = function(){
var self = this;
var v_ws = fs.createWriteStream(self.destination.replace('app.js','vendor.js'));
browserify()
//.transform('debowerify');
.require(vendorBundle)
.bundle()
.pipe(v_ws)
};
Browserify.prototype.buildApp = function() {
var b_ws = fs.createWriteStream(this.destination);
var b = browserify({
entries: this.location,
bundleExternal: false
});
//b.transform('debowerify');
b.external(vendorBundle.map(function (v) {
if (typeof v === 'string') return v;
return v.expose;
}));
b.require(this.location, {expose: 'app'});
b.bundle().pipe(b_ws);
};
new Browserify('./src/scripts/app.js', './_site/scripts/app.js');
scripts/app.js
var d3 = require('d3');
var dd = require('dom-delegate');
function Main(){
this.d3 = d3;
//this.dd = dd;
}
Main.prototype.sum = function(args){
var total = 0; args = args || [];
args.forEach(function(int){
total += int;
});
return total;
};
Main.prototype.write = function(args){
document.getElementById('demo-functional').innerHTML = this.sum(args);
};
module.exports = Main;
closing this due to lack of interest
I have a tiny project as an example, with a simple build process. https://github.com/peter-mouland/debowerify-test
Without debowerify transform, the build creates 2 separate bundles (vendor.js and app.js ). With
debowerify
transform, the contents of vender.js is now included within app.js :(Have you seen this problem before? I have been going round in circles and not found any related issues on the inter-web.