Skip to content

Commit 53300b2

Browse files
committed
fix double file extension
1 parent 062529d commit 53300b2

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

src/idom/web/module.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def module_from_template(
151151
content = Template(template_file.read_text()).substitute(variables)
152152

153153
return module_from_string(
154-
_FROM_TEMPLATE_DIR + "/" + package_name + module_name_suffix(package_name),
154+
_FROM_TEMPLATE_DIR + "/" + package_name,
155155
content,
156156
fallback,
157157
resolve_exports,
@@ -190,6 +190,8 @@ def module_from_file(
190190
symlink:
191191
Whether the web module should be saved as a symlink to the given ``file``.
192192
"""
193+
name += module_name_suffix(name)
194+
193195
source_file = Path(file).resolve()
194196
target_file = _web_module_path(name)
195197
if not source_file.exists():
@@ -206,7 +208,7 @@ def module_from_file(
206208
_copy_file(target_file, source_file, symlink)
207209

208210
return WebModule(
209-
source=name + module_name_suffix(name),
211+
source=name,
210212
source_type=NAME_SOURCE,
211213
default_fallback=fallback,
212214
file=target_file,
@@ -262,6 +264,8 @@ def module_from_string(
262264
Using this option has negative performance consequences since all DOM
263265
elements must be changed on each render. See :issue:`461` for more info.
264266
"""
267+
name += module_name_suffix(name)
268+
265269
target_file = _web_module_path(name)
266270

267271
if target_file.exists() and target_file.read_text() != content:
@@ -275,7 +279,7 @@ def module_from_string(
275279
target_file.write_text(content)
276280

277281
return WebModule(
278-
source=name + module_name_suffix(name),
282+
source=name,
279283
source_type=NAME_SOURCE,
280284
default_fallback=fallback,
281285
file=target_file,
@@ -387,7 +391,6 @@ def _make_export(
387391

388392

389393
def _web_module_path(name: str) -> Path:
390-
name += module_name_suffix(name)
391394
directory = IDOM_WED_MODULES_DIR.current
392395
path = directory.joinpath(*name.split("/"))
393396
return path.with_suffix(path.suffix)

temp.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import idom
2+
3+
4+
victory = idom.web.module_from_template("react", "[email protected]")
5+
VictoryBar = idom.web.export(victory, "VictoryBar")
6+
7+
8+
@idom.component
9+
def Demo():
10+
return VictoryBar()
11+
12+
13+
idom.run(Demo)

0 commit comments

Comments
 (0)