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

91
Vistas
Rollupjs bundling external dependencies

I'm seriously struggling with something that seems so utterly basic. I'm trying to build a web component using lit, and want to include easymde, which is a markdown editor.

My component simply looks like this:

import { LitElement, html } from 'lit';
import easyMDE from 'easymde';

export class MyElement extends LitElement {
    constructor() {
        super();

        console.log('MyElement');
    }

    firstUpdated() {
        const editorEl = this.renderRoot.querySelector('textarea');

        if(!editorEl) {
            throw new Error('Failed to find editor element');
        }

        new easyMDE({
            element: editorEl
        });
    }

    render() {
        return html`
            <textarea></textarea>
        `;
    }
}

And I have the following rollup config

import typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';

export default {
    input: './src/index.ts',
    output: {
        file: 'dist/bundle.js',
        sourcemap: true,
    },
    plugins: [
        typescript(),
        commonjs(),
        nodeResolve(),
    ]
}

However, in my browser, I'm seeing the following error: SyntaxError: Unexpected identifier 'require$$0'. import call expects exactly one argument.

Looking at the bundled output, I'm seeing import require$$0 from 'fs'; at the very top, I don't understand why fs isn't bundled with the rest of my code.

Am I still missing some basic config here?

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