Urgent help needed - Failed to import `replacer` file
See original GitHub issueHi there,
I’ve been trying to use this package successfully but I can’t import the replacer file.
Here is my file structure
mono-repo
- packages
- - project
- - - src
- - - - assets
- - - - component
- - - - - Button
- - pathReplacer.js
- - tsconfig.json
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'
replaceTscAliasPaths()
Can you help me to resolve this problem?
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Awesome.
Thank you so much for your help.
I only looked at the https://github.com/justkey007/tsc-alias#usage section and thought I have to write the
replacer
like that.WELL DONE !!!
This is where your
pathReplacer.js
file will play its part if you put the right code in it.