I found a problem in my app structure and build process using WebPack, TypeScript, and TS-Loader that I thought was caused by TypeScript 2.1.4, but apparently was there the whole time.
You can see all the details from my other post: TypeScript 2.1.4 breaking changes in webpack ts-loader
In short, I have Gulp and WebPack set to an entry point of /client/app.ts which for now has almost nothing in it (certainly nothing referencing /server/) but the TypeScript compilation stage of the WebPack build process is still trying to run on /server (and in my other post, showing a compilation error from the Server folder, when it should only be running from the Client folder).
What am I doing wrong and how can I fix it so it only runs on /client/.ts files, and specifically walk the structure from app.ts?
Here's my repo showing everything I'm working with so far: https://github.com/CmdrShepardsPie/test-ts-app/tree/develop
Thanks
You can work around this bug by specifying the option onlyCompileBundledFiles
in your webpack.config.js
like so
module: {
rules: [
{
test: /\.tsx?/,
use: [{loader: 'ts-loader', options: {onlyCompileBundledFiles: true}}],
}
],
},
I still find it astonishing that ts-loader is broken by default, but at least there's a workaround.
来源:https://stackoverflow.com/questions/41289265/webpack-ts-loader-compiling-all-files-when-i-only-want-it-to-run-in-one-folder-f