Webpack+Typescript 简易配置

2019/02/14 09:18
阅读数 85

教程:https://www.cnblogs.com/yasepix/p/9294499.html

 

http://developer.egret.com/cn/github/egret-docs/extension/threes/instructions/index.html 

 

npm install webpack webpack-cli typescript ts-loader --save-dev

  

 

webpack.config.js

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

 

{
    "compilerOptions": {
        "module": "commonjs",
        "noImplicitAny": true,
        "removeComments": true,
        "target": "es5",
        "sourceMap": true
       "declaration": true
"declarationDir":"./types"
},
    "exclude": [
        "node_modules",
    ]
}

  

{
    "compilerOptions": {
        "outDir": "./build",
        "allowJs": true,
        "target": "es2015",
        // "strictNullChecks":true,
        "experimentalDecorators": true,
        "noImplicitThis": true,
        "traceResolution": true
"declaration": true
"declarationDir":"./types"
},
    "include": [
        "./src/**/*"
    ]
}

  

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部