by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 06 15:35
    kamal250 closed #1139
  • Jul 06 11:43
    kamal250 opened #1139
  • Jul 05 19:28
    kenilam commented #1138
  • Jul 05 19:21
    johnnyreilly commented #1138
  • Jul 05 19:05
    kenilam commented #1138
  • Jul 05 18:59
    kenilam commented #1138
  • Jul 04 07:44
    johnnyreilly commented #1136
  • Jul 04 07:42
    johnnyreilly synchronize #1136
  • Jul 04 07:42

    johnnyreilly on symLinks

    Update CHANGELOG.md (compare)

  • Jul 04 07:39
    johnnyreilly synchronize #1136
  • Jul 04 07:39

    johnnyreilly on symLinks

    Update version to 8.0.0 in pack… (compare)

  • Jul 04 07:38
    johnnyreilly commented #1136
  • Jul 04 07:37
    johnnyreilly review_requested #1136
  • Jul 04 07:35
    johnnyreilly commented #1135
  • Jul 04 07:35
    johnnyreilly commented #1126
  • Jul 04 02:41
    g-plane commented #1126
  • Jul 03 22:20
    stale[bot] labeled #1100
  • Jul 03 22:20
    stale[bot] commented #1100
  • Jul 03 17:46
    sheetalkamat synchronize #1136
  • Jul 03 17:46

    sheetalkamat on symLinks

    More test fixes Use LF to build already built p… (compare)

Luo Gang
@crysislinux

and one more thing

getCustomTransformers ( () => { before?: TransformerFactory[]; after?: TransformerFactory[]; } )

when does after transformers get called? I cannot find any document about this topic

ushakovfserg
@ushakovfserg
Hi. Can someone explain me reason tsLoaderDefinitionFileVersions was added to meta?
It breaks dll manifests with absolute filesystem paths so it couldn't be commited by git.
https://github.com/TypeStrong/ts-loader/blob/c6333810c3c0f06e3e5e6412b211c0e234f0d6d4/src/index.ts#L216
    loader._module.meta.tsLoaderDefinitionFileVersions = allDefinitionFiles
        .concat(additionalDependencies)
        .map(defFilePath => defFilePath + '@' + (instance.files[defFilePath] || { version: '?' }).version);
John Reilly
@johnnyreilly
I can't recall - could be worth looking at our history on github. we're open to PRs that might fix this though!
Ledion Bitincka
@ledbit
I'm trying to get ts-loader to generate declaration files (.d.ts) in a mixed project (js / ts) - but I can't seem to get it to do that. tsc -d on the other hand works just filne
would appreciate any pointers
tsconfig.json looks like this
{
  "compilerOptions": {
    "module": "commonjs",
    "moduleResolution": "node",
    "rootDir": "./src/js",
    "outDir": "./dist",
    "inlineSources": true,
    "target": "es5",
    "noImplicitAny": false,
    "noEmitOnError": true,
    "sourceMap": true,
    "lib": [
      "es2015",
      "dom"
    ],
    "declarationDir": "decl/",
    "declaration": true
  },
  "include": [
    "src/js/**/*.ts",
    "src/js/**/*.tsx",
  ]
}
in webpack I have
...
  module: {
    rules: [
      { test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/ },
...
Eric Anderson
@ericanderson
I think I'm losing my mind. This should work with TS 2.7.2 and esModuleInterop right? It just seems to ignore that setting
antch
@antch
Hi, I'm trying to get my project up and running with ts-loader/ts-lint/fork-ts-checker-webpack-plugin and I'm having a problem where the typechecking/linting doesn't seem to be honoring my include/exclude in tsconfig.json -- is there somewhere else that I'm supposed to set that stuff?
I can set include in tsconfig.json to a glob that matches nothing, and I still get type/lint output for every ts file underneath the webpack context root
antch
@antch
Same with watch, setting that to an invalid path still results in checking/linting for every file
antch
@antch
User error, I had "include" under "compilerOptions" in tsconfig.json
facepalm
Anton Ermak
@raymank26

HI! Guys, does anybody have a luck to work with "*.d.ts" files?

//globals.d.ts

declare module 'my-module' {
    class SomeClass {
        static foo(a: string): void
    }
    export = SomeClass;
}

//MyComponent.vue

 import bar = require('my-module');
....
bar.foo("baz");

Module not found: Error: Can't resolve 'my-module' in ...

//tsconfig.json

{
    "compilerOptions": {
        "outDir": "./built/",
        "sourceMap": true,
        "strict": true,
        "noImplicitReturns": true,
        "module": "amd",
        "moduleResolution": "node",
        "target": "es5",
        "experimentalDecorators": true,
        "strictPropertyInitialization": false
    },
    "include": [
        "./web/**/*"
    ]
}

Any ideas?

Semyon V
@uoziod
is anyone here?
Olmo del Corral
@olmobrutall
Maybe TS doesn’t find your Globals.d.ts
Have you tried adding a ///<reference comment ?
Rich Seviora
@richseviora
Wondering if anyone's ran into issues with ts-loader having trouble referencing modules with .d.ts files based on the module setting in tsconfig.json
In my scenario I have:
{
    "compilerOptions": {
        "target": "esnext",
        "module": "ESNext",
        "jsx": "preserve",
        "declaration": false,
        "outDir": "lib",
        "strict": true,
        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,
        "emitDecoratorMetadata": false
    }
}
And this generates the error
ERROR in /Users/richardseviora/Projects/zhu-li/do/the/thing/IRootState.ts
[tsl] ERROR in /Users/richardseviora/Projects/zhu-li/do/the/thing/IRootState.ts(1,27)
      TS2307: Cannot find module 'immutable'.
However, if I set module to commonjs then it doesn't complain.
Webpack loader config:
      {
        test: /\.tsx?$/,
        loaders: ['babel-loader', 'ts-loader'],
        exclude: /node_modules/,
      },
Rich Seviora
@richseviora
Hmm. This might actually be a TypeScript issue. When I try executing yarn exec tsc -- -m ESNext -t ESNext /Users/richardseviora/Projects/zhu-li/do/the/thing/site.ts, it generates similar "cannot find module '$MODULE'" errors.
Rich Seviora
@richseviora
Ahhhhhh. So setting module to commonjs will set moduleResolution to node automatically, but module: ESNext doesn't do that.
So you have to explicitly set moduleResolution to node .
Thomas Havlik
@thavlik
Hi folks. I am working with a package that merely has an index.d.ts at its root (next to package.json) with "types": "./index.d.ts" in its package.json. tsc is able to compile this project just fine, and VSCode is able to pick up the .d.ts just fine, but ts-loader fails to find the module
Here is my webpack config:
const path = require("path");
const webpack = require("webpack");
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const tsConfigPath = path.resolve(__dirname, "../tsconfig.json");
const rootDir = path.resolve(__dirname, "../");
const outDir = path.resolve(rootDir, "cordova/www/js/");

console.log(`Using tsconfig.json from ${tsConfigPath}`);

module.exports = [{
    mode: "development",
    context: path.resolve(rootDir, "src"),
    entry: "./index.tsx",
    output: {
        path: outDir,
        filename: "bundle.js",
        globalObject: "window"
    },
    devtool: "source-map",
    module: {
        rules: [{
            test: /\.tsx?$/,
            loader: "ts-loader" // "happypack/loader?id=ts" // 
        }]
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin(), // enable HMR globally
        new webpack.NamedModulesPlugin()
    ],
    resolve: {
        extensions: [".tsx", ".ts", ".js"],
        plugins: [new TsconfigPathsPlugin({
            configFile: tsConfigPath
        })]
    },
    target: "node"
}];
additionally, I am actually trying to target "web". I have another project (a web server) that uses target: "node", adds the package in the exact same way, and compilation succeeds (just like compiling with tsc does)
Here is my tsconfig, which is the exact same as the server tsconfig:
{
    "compilerOptions": {
        "module": "commonjs",
        "esModuleInterop": true,
        "target": "es6",
        "noImplicitAny": false,
        "moduleResolution": "node",
        "preserveConstEnums": true,
        "sourceMap": true,
        "outDir": "dist",
        "baseUrl": ".",
        "jsx": "react"
    },
    "include": [
        "./src/**/*"
    ],
    "exclude": [
        "./dist/**/*",
        "./node_modules"
    ]
}
The error in question is Module not found: Error: Can't resolve 'my-type-definitions' in '<path>.ts'. I am importing the module as import Types from "my-type-definitions";
I kind of need this to be importable, so VSCode can get type info. With the way the declaration file is written, it is intended for import.
Thomas Havlik
@thavlik
changing my .d.ts to use export = MyLib; export as namespace MyLib; declare namespace MyLib { ... } still works with vs code and tsc, but doesn't work with ts-loader.
Thomas Havlik
@thavlik
Upon further investigation (errorDetails: true) the compiler is looking only for .ts or .tsx files
Adding index.ts containing only ///<reference path="./index.d.ts" /> seems to permit compilation... that's a suboptimal solution, though
antch
@antch
Any suggestions for linting through ts-loader alongside AngularCompilerPlugin?
Obviously the Angular compiler does tree shaking and emits JS itself, so I'm not sure if it's possible to run those TS files through ts-loader prior to that
I already use the forktschecker plugin for other .ts files so that would be ideal if possible
jestarray
@jestarray
how do i force ts-loader to build even if there's a typescript error ?
using a library that has 70% accurate typings file
and that 30% hits hard
Failing the build on TypeScript compilation error
The build should fail on TypeScript compilation errors as of webpack 2. If for some reason it does not, you can use the webpack-fail-plugin.

For more background have a read of this issue.
should also be reflected on docs on how to disable it
WanderWang
@WanderWang
hey guys ! Anything update about project reference ? TypeStrong/ts-loader#935
Rudi Jansen van Vuuren
@rudivuuren_gitlab
Does anyone know why I am getting Must use import to load ES Module when using webpack and ts-loader? I am targeting es2015 and commonjs module in tsconfig.
stweedie
@stweedie
is there any way to see the intermediate files generated?
I'm getting an error that seems to deal with the null assertion operator
Unexpected token: operator (!)
Pierre-Luc Auclair
@plauclair
Is anyone having any luck combining ts-loader with NormalModuleReplacement?
mukuluec
@mukuluec
Hi all, I need your help on a "Javascript heap out of memory" issue I am getting on compiling ts codebase with webpack, with ts-loader and fork-ts-checker-webpack-plugin. Not using fork-ts-checker-webpack-plugin fixes the issue, because that disables type-checking. The type checker is getting stuck for about 15-20 minutes, before it throws error. How can I see the logs from the type-checker, to find what files it is actually type-checking? Would be really grateful for your help.