Skip to content

Commit 7ab0b9b

Browse files
committed
FEATURE | Improve docs
1 parent 99133fb commit 7ab0b9b

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format
44

55
## [Unreleased]
66

7+
## [1.6.9] - 13.11.2024
8+
### Fixed
9+
- Fixed waning about the __NO_SIDE_EFFECTS__ after building with vite
10+
### Added
11+
- Improved documentation
12+
713
## [1.6.7] - 14.10.2024
814
### Added
915
- Added support for replaceRootWithHost option

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,70 @@ import style from './style.css?raw';
330330

331331
</details>
332332

333+
<details>
334+
<summary>Vite + Rollup Configuration</summary>
335+
336+
### Vite + Rollup Configuration
337+
338+
This configuration provides enhanced build options using Vite with Rollup, including custom element support and development features.
339+
340+
```typescript
341+
import { defineConfig, UserConfig } from 'vite';
342+
import vue from '@vitejs/plugin-vue';
343+
344+
export default defineConfig(({ mode }): UserConfig => {
345+
return {
346+
esbuild: {
347+
// Drop debugger statements in production
348+
drop: mode === 'production' ? ['debugger'] : [],
349+
},
350+
build: {
351+
emptyOutDir: true,
352+
target: 'ES2020',
353+
rollupOptions: {
354+
output: {
355+
// Output files will maintain their original names
356+
entryFileNames: '[name].js',
357+
},
358+
},
359+
// Prevent CSS code splitting
360+
cssCodeSplit: false,
361+
},
362+
plugins: [
363+
vue({
364+
template: {
365+
compilerOptions: {
366+
// Define custom elements that start with 'app-element'
367+
isCustomElement: (tag) => tag.startsWith('app-element'),
368+
},
369+
},
370+
customElement: true,
371+
}),
372+
{
373+
// Hot reload fix for Vue components
374+
name: 'force-reload',
375+
handleHotUpdate({ file, server }) {
376+
if (file.endsWith('.vue')) {
377+
server.ws.send({ type: 'full-reload' });
378+
return [];
379+
}
380+
},
381+
},
382+
],
383+
};
384+
});
385+
```
386+
387+
This configuration includes:
388+
- Production optimization with debugger statement removal
389+
- ES2020 target for modern JavaScript features
390+
- Custom element support for tags starting with 'app-element'
391+
- Disabled CSS code splitting for better web component compatibility
392+
- Hot reload improvements for Vue components
393+
- Rollup output configuration for maintaining file names
394+
395+
</details>
396+
333397
## Web Component without Shadow DOM
334398

335399
If you want to create a web component without Shadow DOM, you can set the `disableShadowDOM` option to `true` in the `createWebComponent` function. This will create a web component without Shadow DOM encapsulation.

0 commit comments

Comments
 (0)