https://github.com/bradymholt/ts-progressive-convert-namespace-modules
Example of progression conversion from TypeScript namespaces to modules
https://github.com/bradymholt/ts-progressive-convert-namespace-modules
Last synced: about 2 months ago
JSON representation
Example of progression conversion from TypeScript namespaces to modules
- Host: GitHub
- URL: https://github.com/bradymholt/ts-progressive-convert-namespace-modules
- Owner: bradymholt
- Created: 2019-08-29T23:16:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-09T16:47:38.000Z (about 4 years ago)
- Last Synced: 2025-02-07T17:24:41.670Z (3 months ago)
- Language: TypeScript
- Size: 125 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ts-progressive-convert-namespace-modules
This repository demonstrates how to progressively convert a TypeScript library that uses global namespaces over to using modules.
The [src/entry.m.ts](https://github.com/bradymholt/ts-progressive-convert-namespace-modules/blob/master/src/entry.m.ts) file is the main [entry point](https://github.com/bradymholt/ts-progressive-convert-namespace-modules/blob/master/webpack.config.js#L6) in the webpack config. This file calls namespaced code and also imports
a module shim that runs namcespaced code. Progressively, namespaced code can be shimmied and then the namespaced code eventually folded directly into the modules.The npm script "bundle" builds the namespace project which emits the outFile `dist/script.js`. This file is referenced in the [index.html](https://github.com/bradymholt/ts-progressive-convert-namespace-modules/blob/master/index.html) file before the webpack bundle is loaded.
## Usage
1. Run `npm install`
1. Run `npm run start`
1. Open http://localhost:5000 in a browser
1. Open devtools console and you should see:```
bite bite bite bite
bark bark bark bark
ooh-ooh-ooh-eee-eee
```