您好,欢迎来到爱玩科技网。
搜索
您的当前位置:首页webpack4.0-打包输出告诉webpack不使用箭头函数 environment(webpack环境配置)

webpack4.0-打包输出告诉webpack不使用箭头函数 environment(webpack环境配置)

来源:爱玩科技网
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin') 
module.exports = {
    mode:'production',
    entry: {
        main:'./src/index.tsx'
    },
    output:{
        filename: '[name].[hash].js',
        path: path.resolve(__dirname, 'dist'),
        // 配置打包输出环境,不使用箭头函数
        environment: {
            arrowFunction: false
        }
    },
    plugins:[
        new HtmlWebpackPlugin({template: './src/index.html'}),
        new CleanWebpackPlugin({cleanOnceBeforeBuildPatterns: ['**/*', '!static-files*']})
    ],
    module:{
        rules:[
            { // 处理 TypeScript文件
                test:/\.tsx$/,
                use:{
                    loader:'ts-loader'
                },
                exclude:/node_modules/
            }
        ]
    }
}

output下面的environment用于配置打包环境 其中, arrowFunction用于配置webpack是否使用箭头函数, 默认为true

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- aiwanbo.com 版权所有 赣ICP备2024042808号-3

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务