-
Notifications
You must be signed in to change notification settings - Fork 282
/
ts-loader.js
28 lines (26 loc) · 956 Bytes
/
ts-loader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// we re-export so that we generate a unique
// optional bundle for the ts-loader, that
// doesn't get loaded unless the user is
// compiling typescript
const logger = require("ts-loader/dist/logger");
const makeLogger = logger.makeLogger;
logger.makeLogger = function (loaderOptions, colors) {
const instance = makeLogger(loaderOptions, colors);
const logWarning = instance.logWarning;
instance.logWarning = function (message) {
// Disable TS Loader TypeScript compatibility warning
if (message.indexOf('This version may or may not be compatible with ts-loader') !== -1)
return;
return logWarning(message);
};
return instance;
};
const { getOptions } = require("loader-utils");
const loader = require("ts-loader");
const tsId = require.resolve("typescript");
module.exports = function () {
const options = getOptions(this);
if (!options.compiler)
options.compiler = tsId;
return loader.apply(this, arguments);
};