Questions tagged [ts-loader]

214 questions
4
votes
1 answer

Code splitting with typescript and webpack

I would like to use the code splitting feature provided by webpack in order to create several bundles of my app, developed using typescript, and load them on demand. I have been searching for a solution on line for a while and the closest answer I…
3
votes
1 answer

Module build failed (from ./node_modules/ts-loader/index.js): Error: TypeScript emitted no output for

**Error** **ERROR in ./src/app-chat.tsx Module build failed (from ./node_modules/ts-loader/index.js): Error: TypeScript emitted no output for D:\React\kasper\new-kasper\kasper-ui-chat\chat\src\app-chat.tsx. at makeSourceMapAndFinish…
Zahar
  • 71
  • 1
  • 6
3
votes
0 answers

Reactjs Next.js 12 Webpack monorepo build error due"Module parse failed: Unexpected token (x:y)"

I have 2 modules in a mono-repo with 2 web applications using ReactJS, NextJS: /project |- api/ |- web/ "react": "^18.2.0", "next": "^12.2.5", "react-dom": "^18.2.0", "rollup": "^2.79.0", "rollup-plugin-ts": "^3.0.2", …
Kok How Teh
  • 3,298
  • 6
  • 47
  • 85
3
votes
2 answers

Why does webpack --watch invoke my custom loader on unrelated files?

I have a simple custom Webpack loader which generates TypeScript code from a .txt file: txt-loader.js module.exports = function TxtLoader(txt) { console.log(`TxtLoader invoked on ${this.resourcePath} with content ${JSON.stringify(txt)}`) if…
Thomas
  • 174,939
  • 50
  • 355
  • 478
3
votes
1 answer

Webpack 5: Change directory for typescript declaration files

My project is structured like this (src/ts folder is important): - dist/ - js/ - css/ - index.html - about.html - src/ - assets/ - fonts/ - images/ - sass/ - ts/ - services/ -…
michaelT
  • 1,533
  • 12
  • 41
3
votes
0 answers

Why am I getting "Cannot find module..." Typescript error for ".vue" file on webpack-dev-server recompilation?

I've setup a small webpack project which creates a Vue app bundle which is included in a static HTML file where the app is injected. I want to have components written in Typescript so I've included ts-loader in the webapck configuration. The build…
3
votes
0 answers

How to make WebWorkes work with typescript and webpack 5 with ts-loader?

I see that in the link https://webpack.js.org/guides/web-workers/ it is said we dont need any more worker-loader. The example is with the javascript. But how can i make it work with typescript and ts-loader with webpack 5. ts-loader complaints in…
last-Programmer
  • 985
  • 3
  • 9
  • 19
3
votes
0 answers

webpack ts-loader - typechecking without compilation/transpilation?

I'm using webpack, babel and few custom loaders (that can handle ES6): (still es6) file_es6.js --> my-loaders ----------> babel --> es5 Now I want to use a typescript loader, and here's where problems started. I…
cimak
  • 1,765
  • 3
  • 15
  • 18
3
votes
0 answers

Using global Rails-UJS in TS modules (Rails with webpacker)

I'm trying to use Rails from @rails/ujs in webpacker ts-loader similar to Rails in the asset pipeline. I want a global variable Rails available in all modules. For now, I can circumvent the problem by importing it in each module, but, for the sake…
RWDJ
  • 734
  • 8
  • 13
3
votes
1 answer

How to produce a single *.d.ts or multiple with relative path

Problem [It only infects typescript library creators] if the code base contains absolute paths (by configuring tsconfig.json and webpack), then the typescript compiler will generate all the d.ts files with the same absolute paths that are useless…
Stav Alfi
  • 13,139
  • 23
  • 99
  • 171
3
votes
1 answer

Type-checking of Vue w/ Typescript but w/o Webpack/ts-loader

Since August 2018 it's possible to compile Typescript code with Babel and have type checking as a separate process. I wonder if it is possible to do type checking of custom file formats like .vue with