javascript - Bundle TypeScript with external JS files (e.g. node_modules) - Stack Overflow

I can successfully bundle together my Typescript project and save it as a single file using e.g.tsc --o

I can successfully bundle together my Typescript project and save it as a single file using e.g.

tsc --outFile "build/bundle.js"

However, this file only contains the Typescript files and none of the files it includes from the "node_modules" directory such as jQuery. If I try to execute the bundle, I'll just get errors the files cannot be found.

How can I add the "node_modules" files that my Typescript depends on to the same single bundle file? Typescript obviously knows where the files are as it has the paths correct.

I'm using SystemJS to load my project in the browser. I'll admit I'm very confused how I'm suppose to go about loading modules and bundling (I could use a SystemJS bundler??) and not understanding why there are so many paths to doing this.

I can successfully bundle together my Typescript project and save it as a single file using e.g.

tsc --outFile "build/bundle.js"

However, this file only contains the Typescript files and none of the files it includes from the "node_modules" directory such as jQuery. If I try to execute the bundle, I'll just get errors the files cannot be found.

How can I add the "node_modules" files that my Typescript depends on to the same single bundle file? Typescript obviously knows where the files are as it has the paths correct.

I'm using SystemJS to load my project in the browser. I'll admit I'm very confused how I'm suppose to go about loading modules and bundling (I could use a SystemJS bundler??) and not understanding why there are so many paths to doing this.

Share Improve this question asked Dec 6, 2016 at 0:19 fstrfstr 9403 gold badges11 silver badges33 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

I found the following in the docs:

Specifying --outFile in conjunction with --module amd or --module system will concatenate all modules in the pilation into a single output file containing multiple module closures.

Alternatively, you can check out the SystemJS Build Tool.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745342056a4623372.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信