typescript-react-loadable-plugin
Version:
A react-loadable plugin to add modules & webpack for typescript
33 lines • 1.26 kB
JavaScript
/*!
* Copyright 2019 acrazing <joking.young@gmail.com>. All rights reserved.
* @since 2019-10-31 19:20:27
*/
import * as path from 'path';
var State = /** @class */ (function () {
function State(options) {
this.getWebpackChunkName =
options.getWebpackChunkName ||
(function (request, context) {
return (path
.basename(request)
.split('.')
.filter(function (s) { return !!s; })[0] ||
path.basename(path.dirname(request)) ||
path.dirname(context));
});
this.moduleKind = options.moduleKind || 'userRequest';
this.identifiers = new Set(options.identifiers || ['Loadable']);
this.webpack = options.webpack !== false;
this.modules = options.modules !== false;
this.webpackChunkName =
options.webpackChunkName !== false ||
this.moduleKind === 'webpackChunkName';
}
State.prototype.setSourceFile = function (source) {
this.sourceFile = source;
this.sourceContext = path.dirname(source.fileName);
};
return State;
}());
export { State };
//# sourceMappingURL=State.js.map