Skip to content

[BUG] - Version 3.1.4 can't be consumed from Common JS #468

Closed
@johnsoukka

Description

@johnsoukka

Context

What version of the module does this affect?
3.1.4

Expected outcome

I expect the code to run without issues.

Actual outcome

I get a type error: TypeError: P.parse is not a function

Description

It seems that from version 3.1.4 it is not possible to consume the lib from Common JS code with require.

Not entirely sure if it is a bug or me missing something else. I can see that in version 3.1.4 esbuild was introduced as the bundler instead of using rollup.

Minimal reproducible test case

In a terminal (npm and node are required) run these commands in order:

mkdir test
cd test
npm init -y
npm i -E [email protected]
echo "const P = require('personnummer');console.log(P.parse('2012121212'));" > index.js
node index

That works fine. Now:

npm i -E [email protected]
node index

It crashes on TypeError: P.parse is not a function

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions