s-panferov / awesome-typescript-loader

Awesome TypeScript loader for webpack
Other
2.35k stars 179 forks source link

Importing TypeScript files from node_modules causes errors #646

Open trulysinclair opened 5 years ago

trulysinclair commented 5 years ago

When importing TypeScript files and trying to build a project, the build fails saying the (typescript) files are "unsupported" and may need an "appropriate loader" to handle them. I'm using awesome-typescript-loader though.

If you would like to see the repository, you can find it here.

yarn run v1.17.3
$ yarn clean && webpack --config config/webpack.config.ts
$ rimraf lib
Using . in C:\Users\adria\Desktop\XplorationByAdrian\touch
Using lib in C:\Users\adria\Desktop\XplorationByAdrian\touch\lib
Using tsconfig.json in C:\Users\adria\Desktop\XplorationByAdrian\touch\tsconfig.json
Using package.json in C:\Users\adria\Desktop\XplorationByAdrian\touch\package.json
Using src in C:\Users\adria\Desktop\XplorationByAdrian\touch\src
Using node_modules in C:\Users\adria\Desktop\XplorationByAdrian\touch\node_modules
i 「atl」: Using typescript@3.6.3 from typescript
i 「atl」: Using tsconfig.json from C:/Users/adria/Desktop/XplorationByAdrian/touch/tsconfig.json
i 「atl」: Checking started in a separate process...
i 「atl」: Time: 648ms
Hash: da2bbabc48518ffba1e2
Version: webpack 4.40.2
Time: 2656ms
Built at: 10/11/2019 1:33:08 AM
 1 asset
Entrypoint main = touch.js
 [7] ./src/touch.ts 350 bytes {0} [built]
[11] (webpack)/buildin/module.js 497 bytes {0} [built]
[16] external "os" 42 bytes {0} [built]
[20] ./src/CommandEcho.ts 365 bytes {0} [built]
    + 17 hidden modules

ERROR in ./node_modules/xba-houston/src/ICommand.ts 1:7
Module parse failed: Unexpected token (1:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> export interface ICommand {
|   /**
|    * Gets the name of the command.
 @ ./node_modules/xba-houston/src/index.ts 5:0-38 5:0-38
 @ ./src/touch.ts

ERROR in ./node_modules/xba-houston/src/CommandBase.ts 3:7
Module parse failed: Unexpected token (3:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| import { ICommand } from './ICommand';
|
> export abstract class CommandBase implements ICommand {
|   public version?: string;
|
 @ ./node_modules/xba-houston/src/index.ts 1:0-44 1:0-44
 @ ./src/touch.ts

ERROR in ./node_modules/xba-houston/src/ICommandManager.ts 3:7
Module parse failed: Unexpected token (3:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| import { ICommand } from './ICommand';
|
> export interface ICommandManager {
|   /**
|    * Attempts to execute a command
 @ ./node_modules/xba-houston/src/index.ts 6:0-52 6:0-52
 @ ./src/touch.ts

ERROR in ./node_modules/xba-houston/src/CommandHandler.ts 4:10
Module parse failed: Unexpected token (4:10)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| export class CommandHandler {
>   private readonly commandMap: Map<string, ICommand> = new Map<
|     string,
|     ICommand
 @ ./node_modules/xba-houston/src/index.ts 2:0-50 2:0-50
 @ ./src/touch.ts

ERROR in ./node_modules/xba-houston/src/HoustonCommandManager.ts 6:10
Module parse failed: Unexpected token (6:10)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| export class HoustonCommandManager extends CommandHandler {
>   private readonly houston: Houston;
|   public constructor(houston: Houston) {
|     super();
 @ ./node_modules/xba-houston/src/index.ts 4:0-64 4:0-64
 @ ./src/touch.ts

ERROR in ./node_modules/xba-houston/src/Houston.ts 6:9
Module parse failed: Unexpected token (6:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| export class Houston {
>   public readonly commandManager: ICommandManager;
|   /**
|    *
 @ ./node_modules/xba-houston/src/index.ts 3:0-36 3:0-36
 @ ./src/touch.ts
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.