Questions tagged [ts-loader]
214 questions
5
votes
3 answers
Mongoose $push typescript errors
It seems like some package upgrade with mongoose or @types/mongoose is now causing new typescript errors from mongoose $push, $pull, $addToSet, and $each operators. For example:
await User.findByIdAndUpdate(request.user._id, {
$push: {
…

Ariel Frischer
- 1,406
- 2
- 12
- 20
5
votes
1 answer
Webpack doesn't bundle TypeScript
I run into the issue of bundling my TS projects. It seems like ts-loader doesn't recognise TypeScript syntax.
The errors I receive:
ERROR in ./src/common/components/chat/chatComponent.tsx
Module parse failed: The keyword 'interface' is reserved…

Petr Shypila
- 1,449
- 9
- 27
- 47
5
votes
1 answer
Do I need babel-loader on top of tsloader to transpile typescript with webpack?
I am writing webpack.config.js to transpile typescript (to be more precise tsx) into ES5 using tsloader and babel-loader.
I have two questions:
1) Do we still need babel-loader even though tsloader output ES5 files?
2) Does it make sense to set…

hitochan
- 1,028
- 18
- 34
5
votes
1 answer
How to get untyped npm modules to play nicely with webpack
I am receiving Invalid module name in augmentation errors from webpack for a couple of library *.d.ts files I am including in my project.
An example is from leaflet-draw which has the following module declaration at the top of it's d.ts file:
import…

mindparse
- 6,115
- 27
- 90
- 191
5
votes
1 answer
Why does ts-loader not compile my typescript?
I am trying to use Webpack to compile some typescript using ts-loader but it is not running tsc as I'm expecting. If I make changes to a ts file, webpack is not compiling it back to js, the same happens if I delete the generated js file altogether…

ChrisO
- 5,068
- 1
- 34
- 47
5
votes
1 answer
"npm run" hanging on ts-loader (webpack)
I am building a web app that consists of static HTML and other assets using webpack on Mac OS X 10.11.3. The app talks to an API that is on another server.
I am having trouble building my app using webpack. The build process appears to hang at or…

serlingpa
- 12,024
- 24
- 80
- 130
4
votes
0 answers
Property 'serviceWorker' does not exist on type 'WorkerNavigator'
I started to upgrade npm packages in my project, but after removing only 1 package (fontawesome pro icons) I start getting this errors in my webpack ts loader.
ERROR in ./src/serviceWorkerRegistration.ts (\src\serviceWorkerRegistration.ts)…

Okrekso
- 41
- 3
4
votes
0 answers
Typescript declaration files .d.ts not found / is not a module
I have moved purely type definitions into a separate file, as index.d.ts.
However, if I run Webpack, compilation fails because \index \index.ts \index.tsx... does not exist. These correspond to my webpack config, on resolve: { extensions: [] }
If I…

David Min
- 1,246
- 8
- 27
4
votes
1 answer
using ts-loader to run emitDeclarationOnly
currently i am using bable-loader to generate the javascript from typescript. but i want to generate typescript declarations as well.
to solve this originally i simply added tsc --emitDeclarationOnly at the end of our build script.
this approach…

ZNackasha
- 755
- 2
- 9
- 29
4
votes
2 answers
Webpack/ts-loader import with .js extension not resolving
My directory structure is as follows:
projectRoot
├── project-server
│ ├── src
│ └── pom.xml
├── project-ui
│ ├── tsconfig.json
│ └── src
│ └── file.ts. (imports ./file.js)
My problem is that project-server uses the transpiled js…

amosq
- 81
- 1
- 8
4
votes
0 answers
Typescript/ts-loader error for typescript dependency
I have a typescript npm module (project B) which uses typescript@3.7.5 and ts-loader@6.2.1 which works fine. I can successfully run my tests inside that project.
I have another typescript project (project A) which pulls in project B as a…

codingninja
- 1,360
- 2
- 13
- 24
4
votes
1 answer
How do I get Webpack and Typescript to use an external node_module folder?
The Setup
I have the bluebird module along with @types/bluebird installed in a node_modules folder.
I also have some .ts files that will be bundled using Webpack and be used in a browser.
For various reasons the node_modules folder is outside the…

user2771609
- 1,867
- 1
- 15
- 36
4
votes
1 answer
ts-loader: import .ts module from other Yarn workspace
I have Yarn workspace structured like this:
/project
package.json
/packages
/app
package.json
webpack.config.js
tsconfig.json
/src
index.ts
/api-adapter
package.json
/src
api.ts
To…

Szopinski
- 790
- 1
- 10
- 18
4
votes
1 answer
unable to use typescript in vue
A while back I created a vue project using vue init webpack .,
and everything worked fine.
Now I tried to install typescript and ts-loader. I created a file in src which contains:
declare module '*.vue' {
import Vue from 'vue'
export default…

Sam
- 2,275
- 9
- 30
- 53
4
votes
1 answer
Webpack + Typescript + watch results in error TS2554 only on re-compilation
Software involved:
webpack 4.8.3
typescript 2.8.3
ts-loader 4.3.0
Webpack configuration:
rules: [
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
use: ['ng-annotate-loader', 'ts-loader']
},
...
]
This compiles my…

deceze
- 510,633
- 85
- 743
- 889