Closed Bielik20 closed 6 years ago
Hi, Could you also provide the import statements In your TS files?
fre 9 mars 2018 kl. 15:35 skrev Damian Bielecki notifications@github.com:
Hello, I was trying to use it on simple test project. My structure is:
- server
- libs
- models
- tsconfig.json
tsconfig.json looks like that:
{ "compilerOptions": { "declaration": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, "lib": ["es6", "dom"], "mapRoot": "./dist", "module": "commonjs", "moduleResolution": "node", "outDir": "./dist", "sourceMap": true, "target": "es6", "typeRoots": [ "node_modules/@types" ], "baseUrl": ".", "paths": { "~/": ["libs/"] } } }
After executing tspath I get this message:
Total files processed: 5 Total paths processed: 2 Operation finished in: 22.956ms Project is prepared, now run it normally!
However paths were not replaced. Files were altered but paths remain the same. What do I do wrong?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/duffman/tspath/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAy_0QCKcMaYj9EpWF3HSLOtamgCUHDks5tcpNFgaJpZM4SkWky .
Sure, here it is:
server/app.ts
import { json, urlencoded } from 'body-parser';
import * as compression from 'compression';
import * as express from 'express';
import * as path from 'path';
import { Foo } from '~/models';
const app: express.Application = express();
app.disable('x-powered-by');
app.use(json());
app.use(compression());
app.use(urlencoded({ extended: true }));
const foo = new Foo();
console.log('App is working ' + foo.name);
export { app };
On a side note ts-node
with tsconfig-paths
installed works perfectly.
Hello, I have managed to find what the issue was. I was using "node": "9.7.1"
, not the lts version. It appears that it doesn't work under version 9.x.x. When I installed version 8.10.0 everything works as expected. I think this issue can be closed and perhaps we could open one about node version 9.x.x.
Anyway, thank you for your response.
Hello, I was trying to use it on simple test project. My structure is:
tsconfig.json looks like that:
After executing tspath I get this message:
However paths were not replaced. Files were altered but paths remain the same. What do I do wrong?