-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debowerify seems to prevent .external()
from working
#62
Comments
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
|
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 Debowerify Test
Without debowerify
With debowerify
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; |
|
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.
The text was updated successfully, but these errors were encountered: