Issue
I have a src working directory like this:
- src
- functions
- final
- utils
I have two files, both inside "final" which I need to transpile from typescript to javascript to run in browser.
The thing is: my final files are importing functions and classes from the other src folders files, but when I transpile it into javascript, it does not work since the imported lines does not actually brings in the functions and classes
my tsconfig.json looks like this:
{
"compilerOptions": {
"target": "es3",
"lib": ["es6", "dom", "es2017", "ES2021"],
"module": "commonjs",
"rootDir": "./src",
"outDir": "./dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
}
What can I do in order to have it transpiled with the modules to the javascript files I need??
Solution
tsc
only compiles files in place. It does not bundle.
To run your project in the browser, you typically need a bundler (such as webpack, parcel, vite, or rollup) to compile and package your code for use in web browsers.
Answered By - Alex Wayne Answer Checked By - Katrina (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.