From f6635e70926a93e3c459e627a44fea8c509b21c1 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Tue, 2 Dec 2025 11:42:46 +0800 Subject: [PATCH] fix: improve the default download version of node to be compatible with vite supported node versions --- dash_vite_plugin/plugin.py | 2 +- tests/test_dash_integration.py | 8 ++++++++ tests/test_plugin.py | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dash_vite_plugin/plugin.py b/dash_vite_plugin/plugin.py index 520d400..63a5b3e 100644 --- a/dash_vite_plugin/plugin.py +++ b/dash_vite_plugin/plugin.py @@ -27,7 +27,7 @@ def __init__( support_less: bool = False, support_sass: bool = False, download_node: bool = False, - node_version: str = '18.17.0', + node_version: str = '18.20.8', clean_after: bool = False, skip_build_if_recent: bool = True, skip_build_time_threshold: int = 5, diff --git a/tests/test_dash_integration.py b/tests/test_dash_integration.py index 017d290..f4acf83 100644 --- a/tests/test_dash_integration.py +++ b/tests/test_dash_integration.py @@ -59,6 +59,7 @@ def test_vite_plugin_integration(self, dash_duo: DashComposite): build_assets_paths=['assets/js'], entry_js_paths=['assets/js/main.js'], npm_packages=[NpmPackage('react')], + download_node=True, clean_after=False, ) @@ -202,6 +203,7 @@ def test_vite_plugin_with_less_support(self, dash_duo: DashComposite): entry_js_paths=['assets/js/main.js'], npm_packages=[NpmPackage('react')], support_less=True, + download_node=True, clean_after=False, ) @@ -289,6 +291,7 @@ def test_vite_plugin_with_assets_path_ignore(self, dash_duo: DashComposite): build_assets_paths=['./assets/css', 'assets/js'], # These should be ignored by Dash entry_js_paths=['assets/js/main.js'], npm_packages=[NpmPackage('react')], + download_node=True, clean_after=False, ) @@ -362,6 +365,7 @@ def test_vite_plugin_skip_build_if_recent(self, dash_duo: DashComposite): build_assets_paths=['assets/js'], entry_js_paths=['assets/js/main.js'], npm_packages=[NpmPackage('react')], + download_node=True, clean_after=False, skip_build_if_recent=True, skip_build_time_threshold=5, # 5 second threshold @@ -459,6 +463,7 @@ def test_vite_plugin_with_custom_tmp_dir(self, dash_duo: DashComposite): entry_js_paths=['assets/js/main.js'], npm_packages=[NpmPackage('react')], plugin_tmp_dir='_custom_vite', + download_node=True, clean_after=False, ) @@ -535,6 +540,7 @@ def test_vite_plugin_with_clean_after(self, dash_duo: DashComposite): build_assets_paths=['assets/js'], entry_js_paths=['assets/js/main.js'], npm_packages=[NpmPackage('react')], + download_node=True, clean_after=True, ) @@ -678,6 +684,7 @@ def test_vite_plugin_with_vue_support(self, dash_duo: DashComposite): build_assets_paths=['assets/js', 'assets/vue'], entry_js_paths=['assets/js/main.js'], npm_packages=[NpmPackage('vue')], + download_node=True, clean_after=False, ) @@ -878,6 +885,7 @@ def test_vite_plugin_with_react_support(self, dash_duo: DashComposite): NpmPackage('react'), NpmPackage('react-dom'), ], + download_node=True, clean_after=False, ) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 1bf6eee..36a64d5 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -38,7 +38,7 @@ def test_plugin_initialization(self): assert plugin.support_less is False assert plugin.support_sass is False assert plugin.download_node is False - assert plugin.node_version == '18.17.0' + assert plugin.node_version == '18.20.8' assert plugin.clean_after is False assert plugin.skip_build_if_recent is True assert plugin.skip_build_time_threshold == 5