#Some files do not get compiled

22 messages · Page 1 of 1 (latest)

azure temple
#

Hey it's me again, but this time, i can't get some of my files to compile, and I really don't know why.

Here is my ts config:

{
    "compilerOptions": {
        "declaration": true,
        "outDir": "dist",
        "rootDir": "src",
        "target": "ES2022",
        "module": "NodeNext",
        "lib": ["ES2020"],
        "strict": true,
        "esModuleInterop": true,
        "forceConsistentCasingInFileNames": true,
        "skipLibCheck": false,
        "moduleResolution": "node16",
        "removeComments": true,
        "preserveConstEnums": true,
        "noImplicitAny": true,
        "resolveJsonModule": true
    },
    "include": [
        "src/*",
        "src/**/*",
        "src/**/**/*",
        "src/database/*.sqlite"
    ],
    "exclude": [
        "node_modules",
        "dist",
        "tests"
    ]
}

and here is my ts file structure:

#

Here is my dist output:

hybrid crystal
#

multiple things

azure temple
#

the database folder specifically doesnt get into dist

hybrid crystal
#
"src/*",
"src/**/*",
"src/**/**/*",

is redundent, you can just write ./src/**/*.ts and it will use the glob to include all the TS files in the src folder

hybrid crystal
azure temple
#

oh

hybrid crystal
#

the include property only list the files that must be compiled
and the compiler can only compile TS files

#

if you want to copy some files after the compilation, you'll have to use a 3rd party solution (npm script, bash script, other build chain, etc.)

azure temple
#

Hm i see

hybrid crystal
#
"exclude": [
    "node_modules",
    "dist",
    "tests"
]

is redundent as well
exclude only excludes what's included in the first place
if node_modules doesn't fall under ./src/**/*.ts, it won't be included in the first place, and no need to exclude it

#

so you could just have "exclude": []

#

or completely remove it

azure temple
#

initially there was no include: [], i added that as a desperate attempt to make my db folder appear

#

I guess I can use fs for my issue then

#

also is it better i remove exclude or include then?

#

I'd assume it doesnt matter which one I use, but I could be wrong on this

hybrid crystal
#

usually, exclude is not needed

#

you only want to include what you need, usually src

#

so

{
    "include": ["./src/**/*.ts"]
}
azure temple
#

thank you so much!

hybrid crystal