Skip to content

Commit

Permalink
Generalize wrapPath => wrap (same as require.js optimizer), see #770
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Jul 18, 2019
1 parent 6a0c8d6 commit f766a8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
5 changes: 4 additions & 1 deletion js/grunt/buildRunnable.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ module.exports = async function( repo, minifyOptions, instrument, allHTML, brand
insertRequire: repo + '-main',
instrument: instrument,
brand: brand,
wrapPath: 'phet.chipper.runRequireJS'
wrap: {
start: 'phet.chipper.runRequireJS = function() {',
end: '};'
}
} );

// Debug version is independent of passed in minifyOptions. PhET-iO brand is minified, but leaves assertions & logging.
Expand Down
11 changes: 4 additions & 7 deletions js/grunt/requireBuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ const requirejs = require( 'requirejs' );
module.exports = function( repo, mainConfigFile, options ) {

const {
// {string|null} - If provided, the contents of the require.js build will be wrapped inside a function that is
// assigned to the given path (e.g. phet.chipper.runRequireJS).
wrapPath = null,
// {Object|boolean} - See https://github.com/requirejs/r.js/blob/master/build/example.build.js for the wrap
// documentation, as it lists all of the available options.
wrap = false,

insertRequire = false,
instrument = false,
Expand Down Expand Up @@ -57,10 +57,7 @@ module.exports = function( repo, mainConfigFile, options ) {

optimize: 'none',

wrap: wrapPath ? {
start: `${wrapPath} = function() {`,
end: '};'
} : false,
wrap: wrap,

// Avoid optimization names that are outside the baseUrl, see http://requirejs.org/docs/optimization.html#pitfalls
paths: {
Expand Down

0 comments on commit f766a8e

Please sign in to comment.