Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

484
Vistas
export 'default' was not found when I try to import my webpack library

This is my source code ./source/client/main.jsx.

export default {
  test: () => console.log('Flow')
};

And this is my webpack.config.cjs.

const path = require('path');
const webpack = require('webpack');
const packageJSON = require('./package.json');

module.exports = (env, argv) => {
  return {
    mode: 'development',
    entry: './source/client/main.jsx',
    // entry: './main.js',
    output: {
      path: path.join(__dirname, 'release'),
      filename: 'main.js',
      library: {
        name: packageJSON.name,
        type: 'umd'
      }
    },
    devtool: 'source-map',
    module: {
      rules: [
        {
          test: /\.jsx?$/,
          exclude: /node_modules/,
          use: {
            loader: 'babel-loader',
            options: {
              presets: [
                '@babel/preset-env',
                '@babel/preset-react'
              ],
              plugins: [
                '@babel/plugin-transform-runtime'
              ]
            }
          }
        }
      ]
    }
  };
};

My package.json contains a list of dependencies and both main and module pointing to the webpack product.

  "main": "./release/main.js",
  "module": "./release/main.js",

However, when I try to import my module in another webpack project, I get the default was not found error.

import Test from 'test';
export 'default' (imported as 'Test') was not found in 'test' (module has no exports)

Am I building the module wrong?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda