
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@amoutonbrady/vite-plugin-solid
Advanced tools
A simple integration to run solid-js with vite
.js .ts .jsx .tsx
) out of the box$ npx degit amoutonbrady/vite-plugin-solid/playground my-solid-project
$ cd my-solid-project
$ npm install
$ npm run dev # starts dev-server with hot-module-reloading
$ npm run build # builds to /dist
Install vite and vite-plugin-solid as dev dependencies
# with npm
$ npm install -D vite @amoutonbrady/vite-plugin-solid
# with pnpm
$ pnpm add -D vite @amoutonbrady/vite-plugin-solid
# with yarn
$ yarn add -D vite @amoutonbrady/vite-plugin-solid
Add it as plugin to vite.config.ts
// vite.config.ts
import { UserConfig } from "vite";
import { solidPlugin } from '@amoutonbrady/vite-plugin-solid';
const config: UserConfig = {
root: "src",
outDir: "dist",
plugins: [solidPlugin()],
// Vite and Esbuild being opinionated about how to manage JSX,
// you need to disable it to prevent extra stuff going in your bundle
// Luckily, vite is still quite fast even skipping Esbuild
enableEsbuild: false,
};
export default config;
Or vite.config.js
// vite.config.js
import { solidPlugin } from '@amoutonbrady/vite-plugin-solid';
/**
* @type {import('vite').UserConfig}
*/
const config = {
root: "src",
outDir: "dist",
plugins: [solidPlugin()],
// Vite and Esbuild being opinionated about how to manage JSX,
// you need to disable it to prevent extra stuff going in your bundle
// Luckily, vite is still quite fast even skipping Esbuild
enableEsbuild: false,
};
export default config;
Finally you have to add a bit of code to your entry point to activate HMR. This might be handled automatically at some point by the plugin but for now it's manual.
const rootEl = document.getElementById("app");
const dispose = render(() => App, rootEl);
// HMR stuff, this will be automatically removed during build
// /!\ You need to add "vite" in the "compilerOptions.types" of your tsconfig.json
// if you want to avoid type errors here
if (import.meta.hot) {
import.meta.hot.accept();
import.meta.hot.dispose(() => {
dispose();
rootEl.textContent = "";
});
}
Just use regular vite
or vite build
commands
{
"scripts": {
"dev": "vite",
"build": "vite build"
}
}
You can pass options to the plugin via vite.config.(js|ts)
import { solidPlugin } from '@amoutonbrady/vite-plugin-solid';
const options = {
babel: {
presets: ['@babel/preset-env'],
},
};
const config = {
root: "src",
outDir: "dist",
plugins: [solidPlugin(options)],
enableEsbuild: false,
};
export default config;
For now the only options is to add extra babel config.
You can checkout the playground
More example will come to full proof the plugin
This is an early version, some things may not work as expected. Please report findings.
Join solid discord
FAQs
solid-js integration plugin for vite
The npm package @amoutonbrady/vite-plugin-solid receives a total of 13 weekly downloads. As such, @amoutonbrady/vite-plugin-solid popularity was classified as not popular.
We found that @amoutonbrady/vite-plugin-solid demonstrated a not healthy version release cadence and project activity because the last version was released 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
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.