{"action":"opened","issue":{"url":"https://api.github.com/repos/TypeStrong/ts-loader/issues/832","repository_url":"https://api.github.com/repos/TypeStrong/ts-loader","labels_url":"https://api.github.com/repos/TypeStrong/ts-loader/issues/832/labels{/name}","comments_url":"https://api.github.com/repos/TypeStrong/ts-loader/issues/832/comments","events_url":"https://api.github.com/repos/TypeStrong/ts-loader/issues/832/events","html_url":"https://github.com/TypeStrong/ts-loader/issues/832","id":356383844,"node_id":"MDU6SXNzdWUzNTYzODM4NDQ=","number":832,"title":"Module build failed: TypeError: Cannot read property getEmitOutput when pass data to ts-loader from the right loader","user":{"login":"liz282907","id":11833779,"node_id":"MDQ6VXNlcjExODMzNzc5","avatar_url":"https://avatars2.githubusercontent.com/u/11833779?v=4","gravatar_id":"","url":"https://api.github.com/users/liz282907","html_url":"https://github.com/liz282907","followers_url":"https://api.github.com/users/liz282907/followers","following_url":"https://api.github.com/users/liz282907/following{/other_user}","gists_url":"https://api.github.com/users/liz282907/gists{/gist_id}","starred_url":"https://api.github.com/users/liz282907/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liz282907/subscriptions","organizations_url":"https://api.github.com/users/liz282907/orgs","repos_url":"https://api.github.com/users/liz282907/repos","events_url":"https://api.github.com/users/liz282907/events{/privacy}","received_events_url":"https://api.github.com/users/liz282907/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-03T07:14:39Z","updated_at":"2018-09-03T07:14:39Z","closed_at":null,"author_association":"NONE","body":"### Expected Behaviour\r\nto support the function of :  require('xx.name.json2')  = get data in the json2 file and inject to the tsx\r\nfile . i wrote the json2 loader. and then i have to pass the loader output data to ts-loader. however ,i got the following output: \r\n```\r\n error  in ./src/controls-refactor/controls/datetime/index.control.json2\r\n\r\nModule build failed: TypeError: Cannot read property 'getEmitOutput' of undefined\r\n    at Object.getEmitOutput (/Users/chenlu/repos/xure/node_modules/ts-loader/dist/instances.js:184:41)\r\n    at getEmit (/Users/chenlu/repos/xure/node_modules/ts-loader/dist/index.js:196:37)\r\n    at successLoader (/Users/chenlu/repos/xure/node_modules/ts-loader/dist/index.js:34:11)\r\n    at Object.loader (/Users/chenlu/repos/xure/node_modules/ts-loader/dist/index.js:21:12)\r\n```\r\n\r\n### Steps to Reproduce the Problem\r\n#### the vue.config.js\r\n```\r\nconst path = require('path');\r\nmodule.exports = {\r\n    chainWebpack: config => {\r\n        config.resolve.extensions\r\n            .add('.json2');\r\n        config.module\r\n            .rule('control-json')\r\n            .test(/\\.control\\.json2$/)\r\n            .use('ts-loader')\r\n                .loader('ts-loader')\r\n                // .options({\r\n                //     transpileOnly: false,\r\n                //     appendTsxSuffixTo: [\r\n                //         '\\\\.vue$',\r\n                //         '\\.json2$'\r\n                //     ]\r\n                // })\r\n                .end()\r\n            .use('json-control-loader')\r\n                .loader('json-control-loader.js')\r\n                .options({\r\n                    emitFile: false\r\n                })\r\n                .end();\r\n        config.resolveLoader.modules.add(path.resolve(__dirname, 'src', 'controls-refactor', 'cores', 'json-control-loader'));\r\n    }\r\n};\r\n```\r\n\r\nthe actual webpack config:\r\n```\r\n{\r\n        test: /\\.control\\.json2$/,\r\n        use: [\r\n          /* config.module.rule('control-json').use('ts-loader') */\r\n          {\r\n            loader: 'ts-loader'\r\n          },\r\n          /* config.module.rule('control-json').use('control-json2') */\r\n          {\r\n            loader: 'json-control-loader.js',\r\n            options: {\r\n              emitFile: false\r\n            }\r\n          }\r\n        ]\r\n      }\r\n```\r\n\r\n\r\nthe json2 loader output:\r\n```\r\nfunction controlLoader(sourceData,sourcemap){\r\n    const source = sourceData.trim();\r\n   if(this.cacheable) this.cacheable();\r\n   const callback = this.async();\r\n   const hocPath = path.resolve(__dirname,'../hoc.tsx');\r\n   this.addDependency(hocPath);\r\n   const self = this;\r\n    \r\n    return loadHocFile(hocPath).catch(callback)\r\n        .then((hocFile)=>{\r\n            const options = getOptions(this);\r\n            const updatedData = injectJsonToHoc(hocFile,source);  // which is actually a tsx file content(string)\r\n            const emitFile = options && options.hasOwnProperty('emitFile')? options.emitFile : true;\r\n            if(!emitFile){\r\n                callback(null, updatedData); // not work when just pass the sourceData\r\n                return;\r\n            }\r\n         .... other code\r\n```\r\n### Location of a Minimal Repository that Demonstrates the Issue.\r\n"}}
{"actor":{"display_login":"liz282907"}}