File tree Expand file tree Collapse file tree 14 files changed +129
-84
lines changed
cookiecutter/{{ cookiecutter.package_name }}/{{ cookiecutter.import_name }}
CustomDataframe/custom_dataframe/frontend
MaterialLogin/material_login/frontend
RadioButton/radio_button/frontend
template-reactless/my_component/frontend
template/my_component/frontend Expand file tree Collapse file tree 14 files changed +129
-84
lines changed Original file line number Diff line number Diff line change 1
1
# Run the component's dev server on :3001
2
2
# (The Streamlit dev server already runs on :3000)
3
- PORT = 3001
3
+ VITE_PORT = 3001
Original file line number Diff line number Diff line change 1
- import { defineConfig , UserConfig } from "vite"
1
+ import { defineConfig , loadEnv , UserConfig } from "vite"
2
2
import react from "@vitejs/plugin-react-swc"
3
3
4
4
/**
5
5
* Vite configuration for Streamlit React Component development
6
6
*
7
7
* @see https://vitejs.dev/config/ for complete Vite configuration options
8
8
*/
9
- export default defineConfig ( {
10
- base : "./" ,
11
- plugins : [ react ( ) ] ,
12
- server : {
13
- port : process . env . PORT ? parseInt ( process . env . PORT ) : 3001 ,
14
- } ,
15
- build : {
16
- outDir : "build" ,
17
- } ,
18
- } ) satisfies UserConfig
9
+ export default defineConfig ( ( { mode } ) => {
10
+ const env = loadEnv ( mode , process . cwd ( ) )
11
+
12
+ const port = env . VITE_PORT ? parseInt ( env . VITE_PORT ) : 3001
13
+
14
+ return {
15
+ base : "./" ,
16
+ plugins : [ react ( ) ] ,
17
+ server : {
18
+ port,
19
+ } ,
20
+ build : {
21
+ outDir : "build" ,
22
+ } ,
23
+ } satisfies UserConfig
24
+ } )
Original file line number Diff line number Diff line change 1
1
# Run the component's dev server on :3001
2
2
# (The Streamlit dev server already runs on :3000)
3
- PORT = 3001
3
+ VITE_PORT = 3001
Original file line number Diff line number Diff line change 1
- import { defineConfig , UserConfig } from "vite"
1
+ import { defineConfig , loadEnv , UserConfig } from "vite"
2
+ import react from "@vitejs/plugin-react-swc"
2
3
3
4
/**
4
- * Vite configuration for Streamlit Component development
5
+ * Vite configuration for Streamlit React Component development
5
6
*
6
7
* @see https://vitejs.dev/config/ for complete Vite configuration options
7
8
*/
8
- export default defineConfig ( {
9
- base : "./" ,
10
- server : {
11
- port : process . env . PORT ? parseInt ( process . env . PORT ) : 3001 ,
12
- } ,
13
- build : {
14
- outDir : "build" ,
15
- } ,
16
- } ) satisfies UserConfig
9
+ export default defineConfig ( ( { mode } ) => {
10
+ const env = loadEnv ( mode , process . cwd ( ) )
11
+
12
+ const port = env . VITE_PORT ? parseInt ( env . VITE_PORT ) : 3001
13
+
14
+ return {
15
+ base : "./" ,
16
+ plugins : [ react ( ) ] ,
17
+ server : {
18
+ port,
19
+ } ,
20
+ build : {
21
+ outDir : "build" ,
22
+ } ,
23
+ } satisfies UserConfig
24
+ } )
Original file line number Diff line number Diff line change 1
1
# Run the component's dev server on :3001
2
2
# (The Streamlit dev server already runs on :3000)
3
- PORT = 3001
3
+ VITE_PORT = 3001
Original file line number Diff line number Diff line change 1
- import { defineConfig , UserConfig } from "vite"
1
+ import { defineConfig , loadEnv , UserConfig } from "vite"
2
2
import react from "@vitejs/plugin-react-swc"
3
3
4
4
/**
5
5
* Vite configuration for Streamlit React Component development
6
6
*
7
7
* @see https://vitejs.dev/config/ for complete Vite configuration options
8
8
*/
9
- export default defineConfig ( {
10
- base : "./" ,
11
- plugins : [ react ( ) ] ,
12
- server : {
13
- port : process . env . PORT ? parseInt ( process . env . PORT ) : 3001 ,
14
- } ,
15
- build : {
16
- outDir : "build" ,
17
- } ,
18
- } ) satisfies UserConfig
9
+ export default defineConfig ( ( { mode } ) => {
10
+ const env = loadEnv ( mode , process . cwd ( ) )
11
+
12
+ const port = env . VITE_PORT ? parseInt ( env . VITE_PORT ) : 3001
13
+
14
+ return {
15
+ base : "./" ,
16
+ plugins : [ react ( ) ] ,
17
+ server : {
18
+ port,
19
+ } ,
20
+ build : {
21
+ outDir : "build" ,
22
+ } ,
23
+ } satisfies UserConfig
24
+ } )
Original file line number Diff line number Diff line change 1
1
# Run the component's dev server on :3001
2
2
# (The Streamlit dev server already runs on :3000)
3
- PORT = 3001
3
+ VITE_PORT = 3001
Original file line number Diff line number Diff line change 1
- import { defineConfig , UserConfig } from "vite"
1
+ import { defineConfig , loadEnv , UserConfig } from "vite"
2
2
import react from "@vitejs/plugin-react-swc"
3
3
4
4
/**
5
5
* Vite configuration for Streamlit React Component development
6
6
*
7
7
* @see https://vitejs.dev/config/ for complete Vite configuration options
8
8
*/
9
- export default defineConfig ( {
10
- base : "./" ,
11
- plugins : [ react ( ) ] ,
12
- server : {
13
- port : process . env . PORT ? parseInt ( process . env . PORT ) : 3001 ,
14
- } ,
15
- build : {
16
- outDir : "build" ,
17
- } ,
18
- } ) satisfies UserConfig
9
+ export default defineConfig ( ( { mode } ) => {
10
+ const env = loadEnv ( mode , process . cwd ( ) )
11
+
12
+ const port = env . VITE_PORT ? parseInt ( env . VITE_PORT ) : 3001
13
+
14
+ return {
15
+ base : "./" ,
16
+ plugins : [ react ( ) ] ,
17
+ server : {
18
+ port,
19
+ } ,
20
+ build : {
21
+ outDir : "build" ,
22
+ } ,
23
+ } satisfies UserConfig
24
+ } )
Original file line number Diff line number Diff line change 1
1
# Run the component's dev server on :3001
2
2
# (The Streamlit dev server already runs on :3000)
3
- PORT = 3001
3
+ VITE_PORT = 3001
Original file line number Diff line number Diff line change 1
- import { defineConfig , UserConfig } from "vite"
1
+ import { defineConfig , loadEnv , UserConfig } from "vite"
2
2
import react from "@vitejs/plugin-react-swc"
3
3
4
4
/**
5
5
* Vite configuration for Streamlit React Component development
6
6
*
7
7
* @see https://vitejs.dev/config/ for complete Vite configuration options
8
8
*/
9
- export default defineConfig ( {
10
- base : "./" ,
11
- plugins : [ react ( ) ] ,
12
- server : {
13
- port : process . env . PORT ? parseInt ( process . env . PORT ) : 3001 ,
14
- } ,
15
- build : {
16
- outDir : "build" ,
17
- } ,
18
- } ) satisfies UserConfig
9
+ export default defineConfig ( ( { mode } ) => {
10
+ const env = loadEnv ( mode , process . cwd ( ) )
11
+
12
+ const port = env . VITE_PORT ? parseInt ( env . VITE_PORT ) : 3001
13
+
14
+ return {
15
+ base : "./" ,
16
+ plugins : [ react ( ) ] ,
17
+ server : {
18
+ port,
19
+ } ,
20
+ build : {
21
+ outDir : "build" ,
22
+ } ,
23
+ } satisfies UserConfig
24
+ } )
You can’t perform that action at this time.
0 commit comments