The ts-loader web package compiles all files when I want it to run in only one folder / file

I found a problem in the structure of the application and the build process using WebPack, TypeScript and TS-Loader, which I thought were called TypeScript 2.1.4, but apparently were there all the time.

You can see all the details from my other post: TypeScript 2.1.4 violation of changes in the webpack tp loader

In short, I have Gulp, and WebPack is installed at the entry point /client/app.ts, which currently has almost nothing (of course, / server / does not refer to anything), but at the TypeScript compilation stage, the WebPack build process still trying to run on the server (and in my other message, which displays a compilation error from the Server folder when it should be run only from the Client folder).

What am I doing wrong, and how can I fix it so that it only works in the /client/.ts files and specifically moves the structure from app.ts?

Here my repo shows everything I work with so far: https://github.com/CmdrShepardsPie/test-ts-app/tree/develop

thanks

+5
source share
1 answer

You can get around this error by specifying the onlyCompileBundledFiles option in webpack.config.js so that

 module: { rules: [ { test: /\.tsx?/, use: [{loader: 'ts-loader', options: {onlyCompileBundledFiles: true}}], } ], }, 

It still seems surprising to me that ts-loader is corrupted by default, but at least a workaround.

+1
source

Source: https://habr.com/ru/post/1261737/


All Articles