deitch/searchjs

ESM: NPM package does not contains "src" directory

Closed this issue · 2 comments

I'm using an ESM build and you referenced in package.json: "module: src/searchjs.js".

"module": "src/searchjs.js",

But in npm package, "./src" directory is not present. Only "./lib" directory.
Can you publish it with "src" dir ? :)

Thank you and thanks for your great work !

I was trying to keep src in the repo and only the build artifacts published, but perhaps that didn't work. I find it interesting that it hadn't come up before.

Can you reproduce your build process to get the error, so I can address it properly?

It's still an error when you are reffering to a missing directory in your package.json.

It hadn't come up before because new builders with strict ESM support are emerging:

To reproduce the error, read "Getting started" section in ViteJS repository.

$ npm install searchjs

In a JS/React/Vue file:

import searchjs from "searchjs"

const list = [{name:"John",age:25},{name:"Jill",age:30}];
let matches
matches = searchjs.matchObject(list[0],{name:"Johnny"}); // returns false
matches = searchjs.matchArray(list,{name:"John"}); // returns [{name:"John",age:25}]

I temporarily fixed the error by doing in package.json:

"searchjs": "git://github.com/deitch/searchjs#master",