Conversation
| chunk {0} bundle.js (main) 62 bytes [rendered] | ||
| [0] ./.test/node_modules-subdir/app.ts 62 bytes {0} [built] [1 error] | ||
|
|
||
| ERROR in ./.test/node_modules-subdir/~/foo/bar/index.ts |
|
Traced the bug to TypeScript. Modified the language service function getEmitOutput(fileName, emitDeclarationsOnly) {
synchronizeHostData();
var sourceFile = getValidSourceFile(fileName);
var outputFiles = [];
function writeFile(fileName, data, writeByteOrderMark) {
outputFiles.push({
name: fileName,
writeByteOrderMark: writeByteOrderMark,
text: data
});
}
var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitDeclarationsOnly);
if (fileName.lastIndexOf('lib') == -1) {
console.log('getEmitOutput'.magenta, fileName, outputFiles.length)
console.log(sourceFile.getFullText())
}
return {
outputFiles: outputFiles,
emitSkipped: emitOutput.emitSkipped
};
}And in the log I can see that it outputs nothing even though it sees some input text: Will investigate more later |
|
Got it. Its the function The function body is super simple: function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) {
console.log(targetSourceFile.fileName.red, {external:host.isSourceFileFromExternalLibrary(targetSourceFile)}); // My addition
var options = host.getCompilerOptions();
// Emit on each source file
if (options.outFile || options.out) {
onBundledEmit(host);
}
else {
var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile];
for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
var sourceFile = sourceFiles_1[_i];
// Don't emit if source file is a declaration file, or was located under node_modules
if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) {
onSingleFileEmit(host, sourceFile);
}
}
}Basically Seems intentional in the TypeScript's design to not allow external libraries to ship |
|
Thinking this through, for our (ts-loader) host, |
|
Wow! I go to do nursery drop off and check my phone to find this. Good work @basarat :+100: 🌷 |
|
Closing since I think its a bad idea to have the need to transpile |


refs #278
Run as
npm run comparison-tests -- --single-test node_modules-subdirOr cd into test dir, edit
webpack.config.jsin the test dir to have an additional..and run aswebpackin the test dir (withnpm install webpack -g)