-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.js
More file actions
23 lines (17 loc) · 952 Bytes
/
Copy pathindex.js
File metadata and controls
23 lines (17 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'use strict';
module.exports = function () {
};
module.exports.pitch = function (remainingRequest) {
this.cacheable && this.cacheable();
// Route through window.require.
// It's safe to use mixins! in all cases, and necessary for anything where require('mixins').hasMixins(module) is true.
// TODO: We use rawRequest to grab the original request (including text! or etc.)
const requestName = this._module.rawRequest.replace(/^mixins!/, '').replace(/\.js$/, '');
if (requestName === 'jquery') {
const jqueryRequest = JSON.stringify('mixins!' + requestName);
return `module.exports = window.jQuery || window.$ || (typeof window.require === 'function' ? window.require(${jqueryRequest}) : undefined);`;
}
const jsonName = JSON.stringify('mixins!' + requestName);
return `module.exports = window.require(${jsonName});`;
};
module.exports.RequireJsLoaderPlugin = require('./RequireJsLoaderPlugin.js');