-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
much easier way of supporting global-setting libraries, #1409
- Loading branch information
Showing
3 changed files
with
25 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
// Copyright 2023, University of Colorado Boulder | ||
|
||
/** | ||
* webpackGlobalLibraries defined the third party library files that load with a global. | ||
* webpackGlobalLibraries define the third party library files that load with a global. These must be here to support | ||
* building sims through webpack. | ||
* When adding to this file, note that it is most likely tested against the resource located in chipper/dist, so | ||
* full paths are less than ideal. | ||
* | ||
* @author Michael Kauzmann (PhET Interactive Simulations) | ||
*/ | ||
|
||
|
||
// TODO: regex is less than ideal here, but Rule.test is a bit finicky, see https://github.com/phetsims/chipper/issues/1409 | ||
module.exports = { | ||
peggy: /sherpa[\\/]lib[\\/]peggy-3\.0\.2\.js$/, // `sherpa/lib/peggy-3.0.2.js` with windows path support | ||
himalaya: /sherpa[\\/]lib[\\/]himalaya-1\.1\.0\.js$/ // `sherpa/lib/himalaya-1.1.0.js` with windows path support | ||
const assert = require( 'assert' ); | ||
const webpackGlobalLibraries = { | ||
peggy: 'sherpa/lib/peggy-3.0.2.js', | ||
himalaya: 'sherpa/lib/himalaya-1.1.0.js' | ||
}; | ||
|
||
Object.keys( webpackGlobalLibraries ).forEach( key => { | ||
const filePath = webpackGlobalLibraries[ key ]; | ||
|
||
// If you need to support from another repo, just add to this assertion | ||
assert( filePath.startsWith( 'sherpa' ), 'Path must start with the repo to support transpiling, see Transpiler' ); | ||
} ); | ||
|
||
module.exports = webpackGlobalLibraries; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters