Closed Papooch closed 2 months ago
Hi,
Could you show some code of how you're importing?
Thanks, John
the issue is main
in package.json doesn't point to build/src but src, which doesn't exist after an install.
steps to repro
mkdir test
cd test
npm init --yes
npm i boats
node -p 'require("boats")'
although that won't fix it anyway - it looks like the index exports the default
key from 4 files, so it won't work anyway.
You would have to do something like require('boats/build/src/Template').default
in order to use those files
Dang!
I'm pretty slammed at the moment so not sure i have the time until next month... PR would be very welcomed :)
@Papooch I've decided as I don't have time to work on this feature to instead remove programmatic use.
If you would like to expose boats in a programmatic way a PR would be welcomed.
The section of boats to expose would be: https://github.com/j-d-carmichael/boats/blob/main/src/cli.ts#L55 to https://github.com/j-d-carmichael/boats/blob/main/src/cli.ts#L77
Ideally, the cli.ts file would call a new function or class named "boats" and the package.json would both export the types and the said file.
I would imagine something like added to the package json file:
"main": "build/src/boats.js",
"typings": "build/src/boats.d.ts",
For now though, there is no longer an export and I will close this PR.
Describe the bug When trying to import
boats
programmatically, I get the following error:To Reproduce include
import boats from 'boats'
(or the CJS equivalent) in a source file and run it.Expected behavior As per the docs
I would expect this to work and provide some programmatic API.