Skip to content

getting started with solid-element #2127

Closed Answered by georgfaust
georgfaust asked this question in Q&A
Discussion options

You must be logged in to vote

./src/my-element.jsx

import { customElement } from 'solid-element';

customElement('my-element', () => {
  return <div>Hello from My Element!</div>;
});

./index.html

<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <title>My Solid App</title>
    <script type="module" src="./dist/my-element.es.js"></script>
</head>
<body>
    <my-element></my-element>
</body>
</html>

./vite.config

import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';

export default defineConfig({
  plugins: [solidPlugin(),],
  server: { port: 3000 },
  build: {
    lib: {
      entry: './src/my-element.jsx',
      name: 'myElement',
      fileName: (format) => `my-element.${format}.js`,…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by georgfaust
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant