question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generate library with .ts and .js together

See original GitHub issue

Hi,

I am not totally sure if this bug is from this plugin.

What happens and why it is wrong

I am trying to package a library using .ts and .js files at same time, the entry file is a .ts file and this file make a require to a .js file (It is because this files are generated because the base project is made with reasonML and i want to generate the library for multiple languages). The problem is that the output is not valid to consume, this output has require to files that don’t exist in this directory. I don`t know if it is possible to bundle .js and .ts together with this plugin.

I have created a repository with the example i am talking about

What an i doing wrong?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ezolenkocommented, Feb 1, 2019

Try setting allowJs in tsconfig.json. Also can you change requires to imports?

1reaction
ezolenkocommented, Mar 20, 2019

@n2k3s2it check if anything from those js files is actually used, rollup will treeshake imports that are not needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to combine TypeScript code and JS libraries into one file ...
I am a TypeScript newb and I can't imagine I'm the first one to want to combine TS output with random JS libraries...
Read more >
Tutorial for Writing a TypeScript Library - tsmean
How to Write a TypeScript Library ; Step 1: Setup tsconfig.json ; Step 2: Implement your library ; Step 3: Create an index.ts...
Read more >
Documentation - Creating .d.ts Files from .js files - TypeScript
Run the TypeScript compiler to generate the corresponding d.ts files for JS files; (optional) Edit your package.json to reference the types. Adding TypeScript....
Read more >
Chapter 7. Using TypeScript and JavaScript in the same project
Enjoying TypeScript's benefits when working with a JavaScript library; The role of type definition files; Upgrading an existing JavaScript app to TypeScript ...
Read more >
Using Rollup to package a library for TypeScript and JavaScript
The first file is the d.ts declaration file that describes the shape of an existing JavaScript codebase for TypeScript. The second file, bundle....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found