Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove .ts files from published npm module #25

Closed
octavezero opened this issue Aug 11, 2017 · 4 comments
Closed

Remove .ts files from published npm module #25

octavezero opened this issue Aug 11, 2017 · 4 comments

Comments

@octavezero
Copy link

octavezero commented Aug 11, 2017

The published npm module contains both the typescript and javascript files.
When using the module with tsloader and webpack, it throws about 117 errors.

ERROR in ./node_modules/music-metadata/lib/index.ts
Module parse failed: E:\electron\nighthawk\node_modules\music-metadata\lib\index.ts Unexpected token (6:20)
You may need an appropriate loader to handle this file type.
| import common from './common';
| import TagMap, {HeaderType} from './tagmap';
| import EventEmitter = NodeJS.EventEmitter;
| import {ParserFactory} from "./ParserFactory";
| import * as Stream from "stream";
 @ ./src/background/library.ts 3:0-37
 @ ./src/ui/pages.tsx
 @ ./src/ui/shell.tsx
 @ ./src/index.tsx
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/only-dev-server react-hot-loader/patch ./src/index.tsx

ERROR in [at-loader] ./node_modules/music-metadata/lib/ParserFactory.ts:168:11
    TS6133: 'warning' is declared but never used.

ERROR in [at-loader] ./node_modules/music-metadata/lib/Windows1292Decoder.ts:23:26
    TS7006: Parameter 'a' implicitly has an 'any' type.

ERROR in [at-loader] ./node_modules/music-metadata/lib/Windows1292Decoder.ts:23:29
    TS7006: Parameter 'min' implicitly has an 'any' type.

This occurs due to tsloader trying to load the .ts files instead of .js ones. Setting allowsJs to true does not resolve the errors.

When i manually delete the .ts files while keeping the .js and .d.ts files, the module works perfectly.

This occurs for both music-metadata and strtok3.

@Borewit
Copy link
Owner

Borewit commented Aug 12, 2017

I deliberately put the TypeScript files (*.ts) back in the distribution after having lots of issues with other tools like debuggers, not trigger recompile after changes, debugging on JavaScript instead of TypeScript, generating JavaScript files in both the distribution folder and the source folder.

I figured by doing this, it would also make debugging easier as the TypeScript files, with the map files, would allow debuggers to use the original source (TypeScript) instead of the generated JavaScript files.

Hmm... dammit.

@octavezero
Copy link
Author

as per TypeStrong/ts-loader#278 , tsloader cannot compile ts from node_modules. And they don't plan to add it in future.

It might be better to bundle it with webpack to distribute it. Anyone with advanced use cases can clone the sources into the project itself.

@Borewit
Copy link
Owner

Borewit commented Aug 12, 2017

I hope this one fixes your problem v0.7.13, please confirm.

@octavezero
Copy link
Author

v0.7.13 is working perfectly. Thank you for solving it real quick.

@Borewit Borewit closed this as completed Aug 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants