forked from facebook/content-review-filters
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
82 lines (79 loc) · 1.88 KB
/
vite.config.ts
File metadata and controls
82 lines (79 loc) · 1.88 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
73
74
75
76
77
78
79
80
81
82
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the Apache 2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import react from '@vitejs/plugin-react';
import autoprefixer from 'autoprefixer';
import {resolve} from 'path';
import {defineConfig} from 'vite';
import babel from 'vite-plugin-babel';
import dts from 'vite-plugin-dts';
// @ts-expect-error since we have not onboard stylex ts types yet
import stylex from '@stylexjs/postcss-plugin';
const babelConfig = {
presets: ['@babel/preset-typescript'],
plugins: [
[
'@stylexjs/babel-plugin',
{
dev: process.env.NODE_ENV === 'development',
test: process.env.NODE_ENV === 'test',
runtimeInjection: false,
genConditionalClasses: true,
treeshakeCompensation: true,
unstable_moduleResolution: {
type: 'commonJS',
},
},
],
],
};
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
dts({
include: ['packages/content-review-components'],
tsconfigPath: './tsconfig.app.json',
rollupTypes: true,
}),
babel({
babelConfig,
filter: /\.[jt]sx?$/u,
loader: 'jsx',
}),
],
build: {
copyPublicDir: false,
lib: {
entry: resolve(
__dirname,
'packages/content-review-components/ContentReviewComponents.ts',
),
formats: ['es'],
},
rollupOptions: {
external: ['react', 'react/jsx-runtime'],
output: {
entryFileNames: 'main.js',
},
},
},
css: {
postcss: {
plugins: [
stylex({
babelConfig,
include: [
'packages/content-review-components/**/*.{ts,tsx}',
'src/**/*.{ts,tsx}',
],
useCSSLayers: true,
}),
autoprefixer(),
],
},
},
});