Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

92
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!