I set my node.js server in typescript this way:
/src
/...
/dist
/node_modules
/...
/tsconfig.json
/..other conf and typings files
Some files in /src get some configuration from package.json for example. This makes the transpiler creates this hierarchy in dist:
/dist
/src
/...js files
/package.json
My tsconfig.json is as follows:
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"target": "es6",
"noImplicitAny": true,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"resolveJsonModule": true
},
"include": [
"src/**/*",
"typings-custom/**/*.ts"
],
"exclude": [
"./package.json"
]
}
I wonder if it is possible to exclude some dependencies from the dist folder as the relative path stays the same between /src and /dist
Thanks in advance.
I finally resolved my issue by using const { propertyA, propertyB } = require("../package.json"); Someone could please explain why the transpiler doesn't copy the file in this case?