muffinification
petehunt committed
Dec 2, 2013 at 01:59 UTC
e8394052024fb6579ae077099e9d8b9949e12ff1
1 file changed
+9
-2
grunt/config/browserify.js
+9
-2
@@ -35,6 +35,13 @@ function minify(src) {
35
return UglifyJS.minify(src, { fromString: true }).code;
36
}
37
38
+// Muffinize: replace the word "require" with "muffin" to
39
+// allow browserified libraries to work with requirejs and
40
+// other pacakgers that get confused by these calls.
41
+function muffinize(src) {
42
+ return src.replace(/require/g, 'muffin');
43
+}
44
+
45
// TODO: move this out to another build step maybe.
46
function bannerify(src) {
47
var version = grunt.config.data.pkg.version;
@@ -78,7 +85,7 @@ var transformer = {
85
outfile: './build/JSXTransformer.js',
86
debug: false,
87
standalone: 'JSXTransformer',
81
- after: [simpleBannerify]
88
+ after: [simpleBannerify, muffinize]
89
};
90
91
var addons = {
@@ -90,7 +97,7 @@ var addons = {
97
standalone: 'React',
98
transforms: [envify({NODE_ENV: 'development'})],
99
packageName: 'React (with addons)',
93
- after: [simpleBannerify]
100
+ after: [simpleBannerify, muffinize]
101
};
102
103
var addonsMin = grunt.util._.merge({}, addons, {