Skip to content

index.mjs messes up default import #238

Closed
@thany

Description

@thany

Default export not found. This problem started existing since the index.mjs was added. When I delete or rename this file from the installed package, it builds fine. When I put it back, I get these warnings again.

Maybe our webpack config is picking up index.mjs in favour of index.js, but it shouldn't, since I'm explicitly telling it to only find .js and .jsx files in the babel-loader config.

Last known working version is 1.1.2. I'll be downgrading for the time being, since downgrading feels like the most reliable thing to do until a proper fix becomes available.

Expected Behavior

Build OK, no warnings.

Actual Behavior

Warnings everywhere this package is being used:

export 'default' (imported as 'parse') was not found in 'html-react-parser'

Steps to Reproduce

Just import like this:

import parse from 'html-react-parser';

Workaround is to import like this:

import * as parse from 'html-react-parser';

Which works absolutely fine. But since the former notation is in the docs, I'm assuming that's how it's intended to be. Hence why the latter form is a workaround - not a solution.

Reproducible Demo

Sorry, it's a really complicated project, I'm not sure if I can do this. If it's really really really really neccesary, I can give it a go, but honestly, this problem is already costing me so much time 😞

Environment

  • Version: 1.2.4
  • Platform: Windows 10
  • Browser: Firefox 89

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions