Skip to content

Commit cc9a219

Browse files
authored
Fix JS shim default path detection for the no-modules target (#3748)
1 parent 185e9db commit cc9a219

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
## [Unreleased](https://github.com/rustwasm/wasm-bindgen/compare/0.2.89...main)
55

6+
### Fixed
7+
8+
* Fix JS shim default path detection for the no-modules target.
9+
[#3748](https://github.com/rustwasm/wasm-bindgen/pull/3748)
10+
611
### Added
712

813
* Add bindings for `RTCRtpSender.getCapabilities(DOMString)` method, `RTCRtpCapabilities`, `RTCRtpCodecCapability` and `RTCRtpHeaderExtensionCapability`.

crates/cli-support/src/js/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ impl<'a> Context<'a> {
717717
stem = self.config.stem()?
718718
),
719719
OutputMode::NoModules { .. } => "\
720-
if (typeof input === 'undefined' && script_src !== 'undefined') {
720+
if (typeof input === 'undefined' && typeof script_src !== 'undefined') {
721721
input = script_src.replace(/\\.js$/, '_bg.wasm');
722722
}"
723723
.to_string(),

crates/cli/tests/wasm-bindgen/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ fn default_module_path_target_no_modules() {
364364
async function __wbg_init(input) {
365365
if (wasm !== undefined) return wasm;
366366
367-
if (typeof input === 'undefined' && script_src !== 'undefined') {
367+
if (typeof input === 'undefined' && typeof script_src !== 'undefined') {
368368
input = script_src.replace(/\\.js$/, '_bg.wasm');
369369
}",
370370
));

0 commit comments

Comments
 (0)