I am embarking on a journey to initiate a new TypeScript project.
My aim is to keep it simple and lightweight without unnecessary complexities, while ensuring the following:
- Utilize npm
- Implement TypeScript
- Include import statements like:
import { A, B } from 'module';
- Bundle all dependencies from node_modules that were imported using import statements into /build for production
- Compile project source into a single outFile and place it in /build
- Load dependencies at runtime based on imports made using import statements
- Use SystemJS, as I have heard it is on track to becoming the standard module loader
So far, I have initiated a new project with the following steps:
- Used npm to install a framework and its typings for TypeScript
- Compiled via tsc (tsconfig.json) using Visual Studio Code
- Set "module": "system" in tsconfig.json (SystemJS)
- Able to write import statements (since module is set to "system")
- Specified "outFile": "../build/app.js" in tsconfig.json to compile project source into a single file at "build"
What I still need help with:
- Bundling all dependencies from node_modules imported with import statements into /build for production
- Loading dependencies at runtime according to import statements made
I lack experience in setting up and configuring module loaders.
Could you kindly guide me in the right direction?
Researching these topics yields results and npm modules that could be useful, but things can quickly become overwhelming and time-consuming to grasp completely, so any advice from an expert on how best to approach this would be highly appreciated.