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.

Issue integrating typescript

See original GitHub issue

I am currently using this template for my chrome extension, but I now want to switch to using Typescript.

I looked at the Typescript config file and I already see an issue with it and the way this template works

tsconfig.json { "compilerOptions": { "module": "commonjs", "target": "es6", "noImplicitAny": false, "sourceMap": false, "rootDir": "src", "outDir": "dist/js", "noEmitOnError": true, "typeRoots": [ "node_modules/@types" ] } }

but I fail how the typescript config file would integrate with this templates webpack.config.js file.

Any help? Thanks.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
UchennaOkaforcommented, Jun 30, 2020

@Kocal Thank you so much for your contribution to this project, I didn’t expect such a quick reply.

1reaction
Kocalcommented, Jun 29, 2020

Hi,

I’ve used this template with TypeScript and I have no problem.

Be sure to:

  • have TypeScript dependencies installed (typescript ts-loader)
  • configure Webpack and ts-loader, you need to add a new rule in module.rules:
const config = {
  // ...
  module: {
    rules: [
      // ...
      {
        test: /\.tsx?$/,
        loader: 'ts-loader',
        exclude: /node_modules/,
        options: {
          appendTsSuffixTo: [/\.vue$/],
        },
      },
    ]
  }
}
  • and configure TypeScript, this is my tsconfig.json I am using:
{
  "compilerOptions": {
    "rootDir": "src",
    "outDir": "built",
    "module": "es2015",
    "moduleResolution": "node",
    "target": "es2017",
    "sourceMap": true,
    "strict": true,
    "noImplicitReturns": true,
    "allowJs": true
  },
  "include": ["src/**/*.ts", "src/**/*.vue"],
  "exclude": ["node_modules"]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Integrating with Build Tools
Right-Click -> Manage NuGet Packages · Search for Microsoft.TypeScript.MSBuild · Hit Install · When install is complete, rebuild!
Read more >
How to Add TypeScript to a JavaScript Project
One of the big issues when adding TypeScript to your project is that you are adding a layer of indirection between the code...
Read more >
Integrating TypeScript with Webpack | by Uday Hiwarale
In this lesson, we are going to learn how to compile a TypeScript project using Webpack. This setup becomes necessary if you want...
Read more >
TypeScript Compiling with Visual Studio Code
A problem matcher parses build output based on the specific build tool and provides integrated issue display and navigation. VS Code ships with...
Read more >
How to move your project to TypeScript - at your own pace
You might be using TypeScript already · Pair-program JavaScript with VS Code · Using the TypeScript compiler for JavaScript · Turning JavaScript ...
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