-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] full support UMD
module for tsc
#46442
Comments
Yes please. I can't believe TypeScript is as big as it is and has no way to natively output a bundle that can run in a web browser. I always have to try and use Browserify to convert the ts output into something the browser can understand. |
Non-goal 4:
|
@andrewbranch I know it meet some goal your team do not want to see, but this is almost everyone want to do when they come to typescript first time.
and this is not conflict for those reasons.
|
Is there really no way to specify the name of a browser global to be introduced when the |
TypeScript's UMD output does not support creating a browser global. We recommend using an external bundler if this is a scenario for you. |
Got it. Thanks! Using Rollup's UMD feature in conjunction with https://www.npmjs.com/package/rollup-plugin-typescript2 looks like a good approach. |
I'm confusedοΌ it seems that ts team do not want people use the |
Indeed, I was hoping I could do something like |
Suggestion
π Search Terms
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
ts is support UMD module , but not UMD bundle.
Vue
,React
and other package is using UMD and webpack to release their js base packages, but we come to typescript , you must need webpack and rewrite types for browse base code(sync load with<script>
tag)and follow feature to implement this goalοΌ
entryfile
in tsconfig.jsonumdModuleName
in tsconfig.json , this will pack every exported variable inentryfile
to this namespace(outFile can do this)umdBundle
of boolean in tsconfig.jsonumdModuleName
, ability to generate and also be used by typescript as well ( global variable access and type consume ) see code belowπ» Use Cases
generate a umd bundle and can be use either browse
<script>
and other loader (eg. webpack, amd,CommonJS)The text was updated successfully, but these errors were encountered: