Webpack+Typescript 简易配置
教程:https://www.cnblogs.com/yasepix/p/9294499.html
http://developer.egret.com/cn/github/egret-docs/extension/threes/instructions/index.html
1 | npm install webpack webpack-cli typescript ts-loader --save-dev |
webpack.config.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | module.exports = { mode: "development" , entry: './src/index.ts' , target: 'web' , output: { filename: 'main.js' , path: __dirname + "/dist" , libraryTarget: 'umd' , library: 'layx' , libraryExport: 'default' , }, devtool: "source-map" , module: { rules: [ { test: /\.ts?$/, loader: "ts-loader" } ] }, resolve: { extensions: [ ".ts" , ".tsx" , ".js" ] } } |
tsconfig.js
1 2 3 4 5 6 7 8 9 10 11 | { "compilerOptions" : { "module" : "commonjs" , "noImplicitAny" : true , "removeComments" : true , "target" : "es5" , "sourceMap" : true }, "exclude" : [ "node_modules" , ] } |
"declaration": true
"declarationDir":"./types"
1 2 3 4 5 6 7 8 9 10 11 12 13 | { "compilerOptions" : { "outDir" : "./build" , "allowJs" : true , "target" : "es2015" , // "strictNullChecks":true, "experimentalDecorators" : true , "noImplicitThis" : true , "traceResolution" : true }, "include" : [ "./src/**/*" ] } |
"declaration": true
"declarationDir":"./types"
如果您觉得本文对你有用,不妨帮忙点个赞,或者在评论里给我一句赞美,小小成就都是今后继续为大家编写优质文章的动力,百小僧拜谢!
欢迎您持续关注我的博客:)
版权所有,欢迎保留原文链接进行转载:)
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步