https://github.com/flolu/rules-js-default-import
rules_js default import broken
https://github.com/flolu/rules-js-default-import
bazel default-import javascript no-interop rules-js rules-ts swc typescript
Last synced: 2 months ago
JSON representation
rules_js default import broken
- Host: GitHub
- URL: https://github.com/flolu/rules-js-default-import
- Owner: flolu
- Created: 2022-11-30T09:22:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-30T09:22:49.000Z (over 3 years ago)
- Last Synced: 2025-01-09T06:28:28.347Z (over 1 year ago)
- Topics: bazel, default-import, javascript, no-interop, rules-js, rules-ts, swc, typescript
- Language: Starlark
- Homepage: TypeError: (0 , module(...).default) is not a function
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
rules_js default import broken
TypeError: (0 , _sanitizeHtml(...).default) is not a function
# Solution
The solution was rather simple. Setting `"noInterop": true` in `.swccrc` caused this error. Hence just omitting it or setting it to `false` fixes the issue. Read more about it here: https://swc.rs/docs/configuration/modules#commonjs
# Reproduction
**Requirements**
- Node.js
- pnpm (`npm install -g pnpm`)
- Bazelisk (`npm install -g @bazel/bazelisk`)
**Setup**
- `pnpm i` (Install Node dependencies)
**Error**
- `bazelisk run //:bin` (Run app)
```
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/bin.sh
/home/flolu/.cache/bazel/_bazel_flolu/1b8803ef8961710fdd5d7b63a7d56904/execroot/__main__/bazel-out/k8-fastbuild/bin/bin.sh.runfiles/__main__/main.js:10
console.log((0, _sanitizeHtml().default)(html));
^
TypeError: (0 , _sanitizeHtml(...).default) is not a function
at Object. (/home/flolu/.cache/bazel/_bazel_flolu/1b8803ef8961710fdd5d7b63a7d56904/execroot/__main__/bazel-out/k8-fastbuild/bin/bin.sh.runfiles/__main__/main.js:10:41)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
at node:internal/main/run_main_module:17:47
```