-
Notifications
You must be signed in to change notification settings - Fork 529
Do not export ./snippets module in browser mode #1259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Wauplin
merged 12 commits into
templated-inference-python-snippets
from
raise-if-not-node
Mar 11, 2025
Merged
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1a78b16
Raise in snippet templating if not using nodejs
Wauplin 06429f0
refacto
Wauplin d02634c
Merge branch 'main' into raise-if-not-node
Wauplin 24042d7
do not bundle snippets code if browser mode
Wauplin 23fd357
add tsup config
Wauplin ec58abf
test
Wauplin 73e422b
Merge branch 'templated-inference-python-snippets' into raise-if-not-…
Wauplin 3848abe
remove for now
Wauplin be6074a
nit
Wauplin 419bc13
Merge t pushbranch 'raise-if-not-node' of github.com:huggingface/hugg…
Wauplin 9584aea
revert custom import
coyotte508 722b902
fix package.json definition
coyotte508 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { Options } from "tsup"; | ||
|
||
const baseConfig: Options = { | ||
entry: ["./index.ts"], | ||
format: ["cjs", "esm"], | ||
outDir: "dist", | ||
clean: true, | ||
}; | ||
|
||
const nodeConfig: Options = { | ||
...baseConfig, | ||
platform: "node", | ||
}; | ||
|
||
const browserConfig: Options = { | ||
...baseConfig, | ||
platform: "browser", | ||
target: "es2018", | ||
splitting: true, | ||
outDir: "dist/browser", | ||
}; | ||
|
||
export default [nodeConfig, browserConfig]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coyotte508 what would be the best way to do a conditional import here? I haven't found any convincing solution. In
@huggingface/hub
it's not really a problem as everything is included usingexport * from "./lib";
(here).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure there's an issue? Is there an error when just keeping the code as before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it felt weird to do
import * as snippets from "./snippets/index.js";
when we know./snippets/index.js
might not be in the final package. But looks like tooling is done the correct way so perfect 😄