Webpack+Typescript 简易配置


教程: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/**/*"
    ]
}

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM