Questions Tagged [Ts-Loader]
217 questions
0 votes
0 answers
21 views

Ts-Loader Won't Allow Dynamic Module Imports

I am trying to compile a simple index.ts file using webpack's ts-loader; the file uses dynamic imports. In my webpack.config.js I have my alias set to: Images: `path.resolve(__dirname, './src/images'),...
0 votes
0 answers
26 views

Different build result between npm and pnpm

Recently, I have used pnpm instead of npm in the program. I built the project(pnpm run build) and received a ts error. (ts-loader in the webpack) It seems a TS error. but when I used npm it didn't ...
0 votes
1 answer
78 views

Webpack + ts-loader fails on stage 3 decorators: Unexpected character '@'

The following code: const decorator = (constructor: any, _context: any) => constructor @decorator export class Decorated {} fails in Webpack + ts-loader with the message: Unexpected character '@' ...
0 votes
0 answers
24 views

react ts-loader not working with babel loader webpack

Trying to use ts-loader with my webpack configuration, but I keep getting errors on the terminal when I try to build. ERROR in ./src/index.ts 4:12 Module parse failed: Unterminated regular expression (...
  • 1,055
0 votes
1 answer
89 views

Does 'ts-loader' require 'typescript' to be installed inorder to work? For me it worked fine

The npm documentation for using ts-loader suggests installing typescript and so does the official Typescript guide in webpack documentation without actually providing any reasoning behind it. For me, ...
17 votes
6 answers
10k views

Webpack: import TypeScript module both "normally" and as raw string

Using webpack ^v2.2.1, I would like to import a TypeScript module as text, in addition to importing the same module "normally". I've figured that I probably should use the raw-loader. But it isn't ...
  • 17.6k
1 vote
0 answers
25 views

How to get webpack to report typescript errors in HTML templates

I have inherited a project that is stuck on webpack 4 / angular 11 / lerna bootstrap that I am trying to upgrade to webpack 5 / workspaces etc. and it's like a Rubix cube (or Lament Configuration), so ...
0 votes
1 answer
18 views

Webpack can't seem to load css

I am trying to create a npm package for a single .tsx component however When I run wepback I keep getting this error: ERROR in ./src/Chatbot.tsx 184:20 Module parse failed: Unexpected token (184:20) ...
92 votes
7 answers
86k views

Webpack cant resolve TypeScript modules

I build a relay small webpack and typescript demo to play with. If i run webpack with the webpack.config.js i get this error: ERROR in ./js/app.ts Module not found: Error: Can't resolve './MyModule' ...
  • 2,896
1 vote
0 answers
671 views

How to properly configure swc-loader with webpack, when switching from ts-loader for better build performance

I have a ts-loader configuration in webpack, test: /\.tsx?$/, use: [ { loader: 'ts-loader', options: { transpileOnly: true } } ] This was taking like 5 mins of build time. so, ...
  • 3,241
62 votes
4 answers
27k views

Webpack cant compile ts 3.7 (Optional Chaining, Nullish Coalescing)

I try to use typescript 3.7 features like Optional Chaining, Nullish Coalescing. But webpack gives me an error while transpaling. app: Module parse failed: Unexpected token (50:40) app: File was ...
0 votes
2 answers
3k views

Problems importing Typescript and Js files in node modules

I am importing a node module folder that contains both Typescript and JS files. I use ts-loader for the typescript, but for some reason, it is creating a long list of errors and I think it's because ...
5 votes
1 answer
2k views

ts-loader outputs declaration files in subdirectory when importing .json files

I'm having a strange behavior of my ts-loader: When importing *.json file from node_modules the declaration files are generated in a subfolder of dist/ but I expect them to be directly in the dist/ ...
0 votes
1 answer
242 views

How to replace angular2-template-loader in Webpack 5 with ts-loader

I've inherited a Webpack4 Angular 11 lerna bootstrap repo, and I'd like to get us on Webpack5 (as well as workspaces etc.) This repo uses angular2-template-loader with ts-loader and fork-ts-checker-...
7 votes
2 answers
5k views

Typescript Source not showing when using webpack ts-loader

I'm using webpack and ts-loader from a grunt task to transpile Typescript and generate sourcemaps for use debugging production. My team wants to be able to see the original Typescript source, not ...

15 30 50 per page
1
2 3 4 5
…
15
Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest