-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvite.common.ts
More file actions
72 lines (64 loc) · 2.07 KB
/
vite.common.ts
File metadata and controls
72 lines (64 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import babelPluginProposalDecorators from '@babel/plugin-proposal-decorators';
// import babelPluginSyntaxDecorators from '@babel/plugin-syntax-decorators';
import babelPluginSyntaxTypescript from '@babel/plugin-syntax-typescript';
// import babelPluginDecoratorTransforms from 'decorator-transforms';
import { gracileJsx } from '@gracile-labs/jsx/vite';
// import { customElementVuejsPlugin } from 'custom-element-vuejs-integration';
// import { customElementReactWrapperPlugin } from 'custom-element-react-wrappers';
import { babel } from '@rollup/plugin-babel';
import { viteStaticCopy } from 'vite-plugin-static-copy';
export const resolve = {
alias: [
{
find: '@node-flow-elements/nfe',
replacement: '/src/lib',
},
],
};
export const babelConfig = babel({
extensions: [/* '.js', */ '.ts', '.tsx'],
sourceType: 'unambiguous',
babelHelpers: 'bundled', // NOTE: Explicit default.
plugins: [
[babelPluginSyntaxTypescript, { isTSX: true }],
// babelPluginSyntaxDecorators,
// TODO: Test this:
// [babelPluginDecoratorTransforms, {}],
// [
// 'decorator-transforms',
// {
// runtime: {
// import: 'decorator-transforms/runtime',
// },
// },
// ],
[babelPluginProposalDecorators, { version: '2023-11' }],
],
});
export const staticCopy = (mode: string) =>
viteStaticCopy({
targets: [
{
src: 'node_modules/@shoelace-style/shoelace/dist/assets/icons/*.svg',
dest: 'assets/icons',
},
],
});
export const gracileJsxConfig = gracileJsx({
cemPlugin: {
files: ['./src/**/*.el.{js,ts,jsx,tsx}'],
plugins: [
// customElementReactWrapperPlugin({
// modulePath(className, tagName) {
// console.log(className, tagName);
// return `../dist/${tagName.replace('nf-', '')}.el.js`;
// },
// }) as any,
// customElementVuejsPlugin({
// outdir: './vue',
// fileName: 'my-library-vuejs.d.ts',
// globalTypePath: '../components/index.js', // relative to `outdir`
// }) as any,
],
},
});