-
-
Notifications
You must be signed in to change notification settings - Fork 434
Description
Expected Behaviour
It should be possible to specify different options for each file type in webpack.config:
module: {
rules: [
{ test: /.md$/, use: [{loader: "ts-loader", options: {logLevel: 'WARN', transpileOnly: true}}, "otherLoader"]},
{ test: /.ts$/, use: [{loader: "ts-loader", options: {logLevel: 'INFO', transpileOnly: false}}, "otherLoader"]}
]
}
Actual Behaviour
Since 7.0.0 this no longer works. successLoader in index.ts no longer accepts the options as a parameter so the loaderOptions will always be the options specified the first time ts_loader is invoked.
Steps to Reproduce the Problem
Create a webpack config which needs different options for different invocations of ts-loader
This could be fixed by adding a line to getTypeScriptInstance in instances.js:
function getTypeScriptInstance(loaderOptions, loader) {
if (instances.hasOwnProperty(loaderOptions.instance)) {
const instance = instances[loaderOptions.instance];
instance.loaderOptions = loaderOptions; // << Add this line