TheSadMidDeveloper
TheSadMidDeveloper
Explore posts from servers
DDeno
Created by adawg on 10/5/2024 in #help
Deno v2 RC not deploying properly?
@cococore supported now?
11 replies
DDeno
Created by EGamalielGZ on 10/7/2024 in #help
How to publish in JSR a library with workspaces?
what if you have 2 apps in a workspace, the package and playground and you didnt want to publish playground. Would there be an additional setting?
10 replies
DDeno
Created by EGamalielGZ on 10/7/2024 in #help
How to publish in JSR a library with workspaces?
Ah I think what he meant is publishing if youre in the root folder for example 👀 You can do something like
deno task --cwd=packages/core release
deno task --cwd=packages/core release
release script is something like deno publish in your core package for example
10 replies
DDeno
Created by EGamalielGZ on 10/7/2024 in #help
How to publish in JSR a library with workspaces?
Would love to know this as well
10 replies
DDeno
Created by TheSadMidDeveloper on 10/6/2024 in #help
Add provider component to context
Thanks! Would love to extend context type too btw! Is there a way to contribute to this?
8 replies
DDeno
Created by TheSadMidDeveloper on 10/6/2024 in #help
Add provider component to context
Id love to attach it to ctx instead, but not sure how to type it
8 replies
DDeno
Created by TheSadMidDeveloper on 10/6/2024 in #help
Add provider component to context
import { define } from '../utils.ts';

export default define.page(function App({ Component, state }) {
return (
<html>
<body>
<state.SomeProvider someProp="hello">
<Component />
</state.SomeProvider>
</body>
</html>
);
});
import { define } from '../utils.ts';

export default define.page(function App({ Component, state }) {
return (
<html>
<body>
<state.SomeProvider someProp="hello">
<Component />
</state.SomeProvider>
</body>
</html>
);
});
looks good?
8 replies
DDeno
Created by TheSadMidDeveloper on 10/6/2024 in #help
Add provider component to context
Would you say the code above is anti-pattern? If not, should I put it to state instead? and how do I extend PageProps type?
8 replies
DDeno
Created by TheSadMidDeveloper on 10/1/2024 in #help
Redirecting inside a page in Fresh 2.0
No description
3 replies
DDeno
Created by TheSadMidDeveloper on 9/30/2024 in #help
How to load islands in Fresh 2.0 plugins?
The crazy thing is if you have the package deployed to JSR, it works... so this only happens on local
15 replies
DDeno
Created by TheSadMidDeveloper on 9/30/2024 in #help
How to load islands in Fresh 2.0 plugins?
Tried to lower the version to the first alpha (2.0.0-alpha.1) to check if it might be caused by a reacent update, but still the same error
15 replies
DDeno
Created by TheSadMidDeveloper on 9/30/2024 in #help
How to load islands in Fresh 2.0 plugins?
same output
15 replies
DDeno
Created by TheSadMidDeveloper on 9/30/2024 in #help
How to load islands in Fresh 2.0 plugins?
15 replies
DDeno
Created by TheSadMidDeveloper on 9/30/2024 in #help
How to load islands in Fresh 2.0 plugins?
Let me check how I can share the code, but basically I tried creating a fresh project again 1. deno run -Ar jsr:@fresh/[email protected] 2. Added a folder named (whatever) with 2 files - (SomeComponent.tsx, mod.ts) 3. Create a plugin that adds it as island SomeComponent is a default export, just a button with an onClick action. mod.ts exports SomeComponent as named component The plugin
import { App } from 'fresh';
import * as islands from './whatever/mod.ts'; // only contains `SomeComponent` for now

export function somePlugin<T>(
app: App<T>,
) {
const islandsUrl = new URL('./mod.ts', import.meta.url);
for (const key of Object.keys(islands)) {
app.island(islandsUrl, key, islands[key]);
}
}
import { App } from 'fresh';
import * as islands from './whatever/mod.ts'; // only contains `SomeComponent` for now

export function somePlugin<T>(
app: App<T>,
) {
const islandsUrl = new URL('./mod.ts', import.meta.url);
for (const key of Object.keys(islands)) {
app.island(islandsUrl, key, islands[key]);
}
}
and the dev.ts file
import { Builder } from "fresh/dev";
import { app } from "./main.ts";
import { somePlugin } from './plugin.ts'

const builder = new Builder();

somePlugin(app)

// other code
import { Builder } from "fresh/dev";
import { app } from "./main.ts";
import { somePlugin } from './plugin.ts'

const builder = new Builder();

somePlugin(app)

// other code
and running deno task dev already throws an error:
error: Uncaught (in promise) Error: Missing chunk for file:///Users/tmp/sad/fresh-project-test-plugin/plugin/mod.ts#SomeComponent
error: Uncaught (in promise) Error: Missing chunk for file:///Users/tmp/sad/fresh-project-test-plugin/plugin/mod.ts#SomeComponent
15 replies
DDeno
Created by TheSadMidDeveloper on 9/30/2024 in #help
How to load islands in Fresh 2.0 plugins?
If I comment out the SomeComponent export there, it will go to the next component exported and throw the same error
15 replies
DDeno
Created by TheSadMidDeveloper on 9/30/2024 in #help
How to load islands in Fresh 2.0 plugins?
@marvinh. if it's okay to follow up regarding this one, if you look at the way Im installing plugins, the ./islands/mod.ts file there looks like this
export { default as SomeComponent } from './SomeComponent.tsx';
export * from './moreComponents.tsx';
export { default as SomeComponent2 } from './SomeComponent2.tsx';
export { default as SomeComponent3 } from './SomeComponent3.tsx';
export { default as SomeComponent } from './SomeComponent.tsx';
export * from './moreComponents.tsx';
export { default as SomeComponent2 } from './SomeComponent2.tsx';
export { default as SomeComponent3 } from './SomeComponent3.tsx';
is this expect to work? Im getting this error when running deno task dev:
error: Uncaught (in promise) Error: Missing chunk for file:///Users/sad/tmp/fresh_test_library/src/islands/mod.ts#SomeComponent
error: Uncaught (in promise) Error: Missing chunk for file:///Users/sad/tmp/fresh_test_library/src/islands/mod.ts#SomeComponent
15 replies
DDeno
Created by TheSadMidDeveloper on 9/30/2024 in #help
How to load islands in Fresh 2.0 plugins?
Sorry I think I just ran the incorrect command haha. deno task start by default lol
15 replies