如何从Webpack的捆绑文件中排除__esModule?

问题描述

我有一个Webpack配置:

const path = require("path")
const { CleanWebpackPlugin } = require("clean-webpack-plugin")

module.exports = {
    mode: "development",entry: {
        arrow: "./src/1.x.x/index",},module: {
        rules: [
            {
                test: /\.(js)$/,exclude: /node_modules/,use: ['babel-loader']
            }
        ]
    },resolve: {
        extensions: ['*','.js']
    },plugins: [
        new CleanWebpackPlugin({ cleanStaleWebpackAssets: false }),],devtool: 'inline-source-map',devServer: {
        contentBase: './build',output: {
        filename: "[name]-alpha.js",path: path.resolve(__dirname,'build'),library: 'arrow',libraryTarget: 'umd'
    },optimization: {
        splitChunks: {
            chunks: 'all',}

.babelrc

{
  "presets": [
    [
      "@babel/preset-env",{
        "modules": "commonjs","targets": {
          "node": "current"
        }
      }
    ]
  ]
}

此配置在捆绑包中显示__esModule,但我不想公开。

import {__esModule  } from "./arrow-alpha"

如何隐藏它?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)