Commit beec6ae
authored
[WTF-2452] Fix transformation for require of external library with as output format (#157)
## Checklist
- Contains unit tests ❌
- Contains breaking changes ❌
- Compatible with: MX 7️⃣, 8️⃣, 9️⃣
- Did you update version and changelog? ✅
- PR title properly formatted (`[XX-000]: description`)? ✅
## This PR contains
- [x] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Other (describe)
## What is the purpose of this PR?
Fix transformation by the commonjs plugin in case the output format is
es and an external library is required.
## Relevant changes
For React client `require` statements to external libraries need to be
rewritten to an `import` statement. However as the externally libraries
were marked as `ignore` in the commonjs plugin configuration those
require statements were left untouched, causing the runtime error
"require is not defined".
This has been resolved by no longer marking external libraries as
`ignored`.
## What should be covered while testing?
Building widget which needs this transformation can be bundled and run
without a custom rollup config. Examples are:
[calendar-web](https://github.com/mendix/web-widgets/tree/1bf7b6306b72156851e831498549e92280234792/packages/pluggableWidgets/calendar-web)
[color-picker-web](https://github.com/mendix/web-widgets/tree/1bf7b6306b72156851e831498549e92280234792/packages/pluggableWidgets/color-picker-web)
[document-viewer-web](https://github.com/mendix/web-widgets/tree/1bf7b6306b72156851e831498549e92280234792/packages/pluggableWidgets/document-viewer-web)File tree
3 files changed
+6
-2
lines changed- packages/pluggable-widgets-tools
- configs
3 files changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments