Skip to content

Commit 1e83fd4

Browse files
committed
osrd-ui: enable hot reload only when we are in development
1 parent 8ebc593 commit 1e83fd4

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

.github/workflows/osrd-ui-build-and-check.yml .github/workflows/osrd-ui-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Check Code
1+
name: Build osrd-ui
22

33
on: [push]
44

ui-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"rollup": "rollup -c",
2121
"clean": "rimraf dist",
2222
"build": "npm run rollup",
23-
"watch": "rollup -c -w"
23+
"watch": "NODE_ENV=development rollup -c -w"
2424
},
2525
"peerDependencies": {
2626
"react": ">=18.0"

ui-core/rollup.config.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import terser from '@rollup/plugin-terser';
33
import typescript from '@rollup/plugin-typescript';
44
import livereload from 'rollup-plugin-livereload';
55
import postcss from 'rollup-plugin-postcss';
6+
import process from 'process';
67

78
const formats = ['esm'];
9+
const isDev = process.env.NODE_ENV === 'development';
810

911
/** @type {import("rollup").RollupOptions} */
1012
export default {
@@ -24,9 +26,10 @@ export default {
2426
plugins: [],
2527
}),
2628
terser(),
27-
// livereload({
28-
// watch: 'dist',
29-
// }),
29+
isDev &&
30+
livereload({
31+
watch: 'dist',
32+
}),
3033
],
3134
external: ['react'],
3235
};

0 commit comments

Comments
 (0)