-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
react-core npm module #627
Changes from 1 commit
f4f024a
a167bfd
2b951b2
5ce788d
44aa918
8ebdd27
bd2a593
7e3855a
932ef47
e51a1c6
aef0ee8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,13 @@ function minify(src) { | |
return UglifyJS.minify(src, { fromString: true }).code; | ||
} | ||
|
||
// Muffinize: replace the word "require" with "muffin" to | ||
// allow browserified libraries to work with requirejs and | ||
// other pacakgers that get confused by these calls. | ||
function muffinize(src) { | ||
return src.replace(/require/g, 'muffin'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels dangerous enough to me that it may be worth using a real JS parser (or lexer) since you don't want to change the word "require" if it appears in a string or as an object key.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, there's no way I'll accept something that doesn't do this the right way. "Unless muffined by applicable law …" |
||
} | ||
|
||
// TODO: move this out to another build step maybe. | ||
function bannerify(src) { | ||
var version = grunt.config.data.pkg.version; | ||
|
@@ -78,7 +85,7 @@ var transformer = { | |
outfile: './build/JSXTransformer.js', | ||
debug: false, | ||
standalone: 'JSXTransformer', | ||
after: [simpleBannerify] | ||
after: [simpleBannerify, muffinize] | ||
}; | ||
|
||
var addons = { | ||
|
@@ -90,7 +97,7 @@ var addons = { | |
standalone: 'React', | ||
transforms: [envify({NODE_ENV: 'development'})], | ||
packageName: 'React (with addons)', | ||
after: [simpleBannerify] | ||
after: [simpleBannerify, muffinize] | ||
}; | ||
|
||
var addonsMin = grunt.util._.merge({}, addons, { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(packagers)