Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
create-huck
Advanced tools
The following examples show how to set up a typical Layout with Vite providing hot-reloading.
See a complete layout example in the huck-examples repo.
or
See a complete podlet example in the huck-examples repo.
pnpm add -D svelte @sveltejs/vite-plugin-svelte
Ensure the following content in vite.config.js
import { svelte } from '@sveltejs/vite-plugin-svelte'
export default defineConfig({
//...
plugins: [svelte()],
//...
})
Ensure the following content in client/main.js
import App from './App.svelte'
const rootEl = document.querySelector('#app')
new App({ target: rootEl })
and create the client/App.svelte
file
<script>
let count = 0
const handleClick = () => count += 1
</script>
<button on:click={handleClick}>
Count is {count}
</button>
See a complete example in the huck-examples repo.
pnpm add -D vue @vitejs/plugin-vue
Ensure the following content in vite.config.js
import vue from '@vitejs/plugin-react'
export default defineConfig({
//...
plugins: [vue()],
//...
})
Ensure the following content in client/main.js
import { createApp } from 'vue'
import App from './App.vue'
const rootEl = document.querySelector('#app')
createApp(App).mount(rootEl)
and create the client/App.vue
file
<script setup>
import { ref } from 'vue'
const count = ref(0)
const handleClick = () => count.value += 1
</script>
<template>
<button @click="handleClick">
Count is {{ count }}
</button>
</template>
See a complete example in the huck-examples repo.
pnpm add -D react react-dom @vitejs/plugin-react
Ensure the following content in vite.config.js
import react from '@vitejs/plugin-react'
export default defineConfig({
//...
plugins: [react()],
//...
})
Ensure the following content in client/main.jsx
, and rename any references to main.js
into main.jsx
.
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.jsx'
const rootEl = document.querySelector('#app')
ReactDOM.createRoot(rootEl).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
and create the client/App.jsx
file
import { useState } from 'react'
function App() {
const [count, setCount] = useState(0)
return (
<>
<button onClick={() => setCount((count) => count + 1)}>
Count is {count}
</button>
</>
)
}
export default App
The server-emitted HTML must be wrapped by a helper in Vite. The Vite server can be referenced on server.vite
, and server
is available as an argument to the render
hook.
const rootEl = await server.vite.transformIndexHtml(req.url, `<div class="page-container" id="app" ${config}></div>`)
reply.podiumSend(`
${$header}
${rootEl}
${$footer}
`)
FAQs
Unknown package
We found that create-huck demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.