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.

Urgent help needed - Failed to import `replacer` file

See original GitHub issue

Hi there,

I’ve been trying to use this package successfully but I can’t import the replacer file.

Here is my file structure

- packages
- - project
- - - src
- - - - assets
- - - - component
- - - - - Button
- - pathReplacer.js
- - tsconfig.json

In the Button file, I use an alias for the path like require('#/assets/images/button.png')

Here is my project tsconfig.json

  "extends": "../../tsconfig.json",
  "include": ["**/*.ts", "**/*.tsx"],
  "exclude": ["node_modules", "dist"],
  "compilerOptions": {
    "skipLibCheck": true,
    "emitDecoratorMetadata": true,
    "outDir": "dist",
    "isolatedModules": true,
    "declarationDir": "dist",
    "typeRoots": ["./src/types/types.d.ts", "./src/types/styled.d.ts", "../../node_modules/@types"],
    "paths": {
      "#*": ["./src/*"]
  "references": [
      "path": "../ui-core"
  "tsc-alias": {
    "verbose": false,
    "resolveFullPaths": true,
    "replacers": {
      "pathReplacer": {
        "enabled": true,
        "file": "./pathReplacer.js"

I can build the project fine with tsc without errors but as soon I add the tsc-alias section in the tsconfig.json file I get this error

tsc-alias error: Failed to import replacer "./pathReplacer.js"

Here the content of pathReplacer.js

import { replaceTscAliasPaths } from 'tsc-alias'


Can you help me to resolve this problem?

Issue Analytics

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

github_iconTop GitHub Comments

dittmarconsultingcommented, Feb 23, 2022


Thank you so much for your help.

I only looked at the section and thought I have to write the replacer like that.


justkey007commented, Feb 23, 2022

If for instance an Image has a require('#/assets/images/access-camera-roll.png') like that. That is untouched and I only looked at that.

This is where your pathReplacer.js file will play its part if you put the right code in it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

My import failed. What can I do? - ActiveCampaign Help Center
The most common reasons why your contact import failed · "Existing contact details NOT updated" error. · Your CSV file was not UTF-8...
Read more >
Solved: Pipeline fails with import error for dataiku
Solved: I'm trying to run the below example on my jenkins node: Building-a-Jenkins-pipeline-for-Dataiku-DSS In one of the stages, I created python.
Read more >
Solutions to common product CSV import problems
Troubleshooting product CSV files. Identify missing fields or headers, illegal formatting or identifier duplications before contacting support.
Read more >
Review and troubleshoot import errors
Learn how to view and troubleshoot common errors that occur during record imports.
Read more >
Fix problems uploading files on the OneDrive website
In this article, you'll find solutions for some of the error messages you might see when you're uploading files on the OneDrive website....
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 Post

No results found

github_iconTop Related Hashnode Post

No results found