मैं CommonJS मॉड्यूल के रूप में कुछ सामान्य कोड ऊपर बंडल, और फिर वैश्विक से एक अलग बंडल और/या सीधे से उन आम मॉड्यूल का उपयोग करना चाहते।कई बंडलों, मॉड्यूल का उपयोग कर बाहर से
entry1-common.js
-- a.js
-- b.js
entry2-app.js
-- x.js
inside i would like to to access entry1-common's a.js here
var moduleA = require('./a.js');
<script>
// i would also like to access modules from outside
var moduleA = require('./a.js');
var moduleX = require('./x.js');
</script>
मैं गल्प का उपयोग कर रहा हूं। कुछ browserify विकल्प है कि मैं क्या जरूरत होने लगते हैं, लेकिन काफी मुझे वहाँ हो रही है नहीं:
browserify(bundleConfigs: [{
entries: './entry1-common.js',
dest: dest,
outputName: 'common.js',
hasExports: true, // this gives me require() function on the outside
require: ['jquery']
}])
मैं 'से लेकर' बंडल करने और 'duplexer' की ज़रूरत है? मैंने ब्राउज़र के दस्तावेज़ों में इसके उदाहरण देखे हैं।
मैं अपने घूंट कार्य में दो अलग-अलग बंडलों बना सकते हैं, लेकिन मैं कैसे अन्य एक से मॉड्यूल का उपयोग करने की जानकारी नहीं है।
इस उत्तर पर एक नज़र डालें: http://stackoverflow.com/a/30294762/2943490 – user2943490