第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何使用 useBuiltIns: "usage" 排除 core-js

如何使用 useBuiltIns: "usage" 排除 core-js

使用 babel 7.5.5、core-js 3.1.4 和 webpack 4.38.0,我如何從轉(zhuǎn)譯中排除 core-js?我不想node_modules完全排除,因為我有需要轉(zhuǎn)譯的庫如果我使用exclude: /node_modules\/(core-js)/,一個 core-js 模塊會拋出類型錯誤:$ 不是函數(shù)這讓我有另外兩個選擇。改用包含,包含我的 src 目錄和需要一一轉(zhuǎn)換的每個依賴項使用useBuiltIns: entry而不是使用,因為在這種情況下exclude: /node_modules/\(core-js)/有效,并且importcore.js 位于 main.js 的頂部這兩個選項對我來說似乎都不是很好的解決方案,因為usage自 7.4以來“不再是實驗性的”。有什么辦法可以使用用法讓它工作嗎?它是 babel-loader 還是 babel 中的錯誤?還是我的配置有問題?這是我的 Webpack 配置:const path = require('path');const webpack = require('webpack');module.exports = {    mode: 'production',    entry: {        main: ['./src/main'],    },    output: {        path: path.resolve(__dirname, './build/'),        publicPath: '/build/'    },    module: {        rules: [            {                test: /\.js$/,                exclude: /node_modules\/(core-js)/,                use: {                    loader: 'babel-loader'                },            },            {                test: require.resolve('jquery'),                use: [                    {                        loader: 'expose-loader',                        options: 'jQuery'                    },                    {                        loader: 'expose-loader',                        options: '$'                    }                ]            }        ]    },    plugins: [        new webpack.ProvidePlugin({            $: 'jquery',            jQuery: 'jquery',            'window.jQuery': 'jquery'        })    ],};這是我的 babel 配置:module.exports = function (api) {    api.cache(true);    return {        presets: [            [                '@babel/preset-env',                {                    corejs: {                        version: 3,                    },                    useBuiltIns: 'usage',                }            ]        ],    };};您可以使用以下存儲庫重現(xiàn)錯誤:https : //github.com/tomm1996/usebuiltins-exclude-test
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 466 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號