I am using ts-alias to replace the path alias in typescript, the command in package.json
look like this:
"scripts": {
"build": "tsc && tsc-alias"
},
now I found the tsc-alias replace the import unexpectly, the original import look like in .ts file:
// @ts-ignore
import * as Y from "yjs";
the tsc-alias replaced the content in .js to:
// @ts-ignore
import * as Y from "../yjs";
this should not be replaced, am I missing something? what should I do to fixed this issue? this is the package.json look like:
{
"name": "texhub-broadcast",
"version": "1.0.29",
"description": "",
"main": "./dist/app.js",
"module": "./dist/app.js",
"types": "./dist/app.d.ts",
"type": "module",
"exports": {
"./dist/websocket/conn/socket_io_client_provider": "./dist/websocket/conn/socket_io_client_provider.js",
".": {
"import": "./dist/app.js"
}
},
"files": [
"dist/*"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint --fix",
"dev": "export NODE_ENV=dev && ts-node -r tsconfig-paths/register src/app.ts",
"build": "tsc && tsc-alias"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@socket.io/admin-ui": "^0.5.1",
"dotenv": "^16.4.7",
"esm-module-alias": "^2.2.1",
"express": "^4.21.2",
"flatted": "^3.3.2",
"globals": "^15.14.0",
"jsonwebtoken": "^9.0.2",
"level": "^9.0.0",
"leveldown": "^6.1.1",
"levelup": "^5.1.1",
"lib0": "^0.2.99",
"lodash": "^4.17.21",
"log4js": "^6.9.1",
"meilisearch": "^0.35.1",
"module-alias": "^2.2.3",
"pg": "^8.13.3",
"prom-client": "^14.2.0",
"socket.io": "^4.8.1",
"socket.io-client": "^4.8.1",
"ws": "^8.18.0",
"y-leveldb": "^0.1.2",
"y-protocols": "^1.0.6",
"y-websocket": "^1.5.0",
"yjs": "^13.6.23"
},
"devDependencies": {
"@types/express": "^5.0.0",
"@types/jsonwebtoken": "^9.0.8",
"@types/lodash": "^4.17.15",
"@types/node": "^22.13.8",
"@types/pg": "^8.11.11",
"@types/ws": "^8.5.14",
"@typescript-eslint/eslint-plugin": "^8.22.0",
"@typescript-eslint/parser": "^8.22.0",
"eslint": "^9.19.0",
"ts-node": "^10.9.2",
"ts-patch": "^3.3.0",
"tsc-alias": "^1.8.10",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.7.3",
"typescript-transform-paths": "^3.5.3",
"vite": "^6.0.11",
"vite-node": "^3.0.4",
"vitest": "^3.0.4"
}
}
I make a minimal reproduce example:
// @ts-ignore
import * as Y from "yjs";
import express, { Express } from "express";
export const app: Express = express();
import http from "http";
var httpServer = http.createServer(app);
export const getYDoc = ()=>{
const ydoc = new Y.Doc({});
}
httpServer.listen(1234);
and run tsc && tsc-alias
,but did not reproduce this issue, it so wired.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745040993a4607804.html
评论列表(0条)