@mapvx/web-components-ssr 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -1
- package/dist/browser/main.js +24 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1051,6 +1051,31 @@ function App() {
|
|
|
1051
1051
|
|
|
1052
1052
|
### Common Issues
|
|
1053
1053
|
|
|
1054
|
+
#### `SyntaxError: Unexpected token 'export'`
|
|
1055
|
+
|
|
1056
|
+
**Problem**: The bundle is loaded as a classic script. Since `1.3.0` `main.js` is an ES module
|
|
1057
|
+
that lazy-loads sibling `chunk-*.js` files, so a plain `<script src="…/main.js">` fails to parse.
|
|
1058
|
+
Nothing on the page runs, `customElements.define('mapvx-website', …)` is never reached, and the
|
|
1059
|
+
`<mapvx-website>` element stays empty — no list, no map, and no other error in the console.
|
|
1060
|
+
|
|
1061
|
+
**Solution**: add `type="module"` to the script tag (this replaces the old `defer`, which modules
|
|
1062
|
+
apply on their own):
|
|
1063
|
+
|
|
1064
|
+
```html
|
|
1065
|
+
<script
|
|
1066
|
+
type="module"
|
|
1067
|
+
src="https://unpkg.com/@mapvx/web-components-ssr@1.6.0/dist/browser/main.js"
|
|
1068
|
+
></script>
|
|
1069
|
+
<link
|
|
1070
|
+
rel="stylesheet"
|
|
1071
|
+
href="https://unpkg.com/@mapvx/web-components-ssr@1.6.0/dist/browser/styles.css"
|
|
1072
|
+
/>
|
|
1073
|
+
```
|
|
1074
|
+
|
|
1075
|
+
When self-hosting the bundle instead of using a CDN, copy every `.js` file out of
|
|
1076
|
+
`dist/browser` keeping the `chunk-*.js` names: the relative `import()` calls in `main.js` resolve
|
|
1077
|
+
against its own URL.
|
|
1078
|
+
|
|
1054
1079
|
#### `SyntaxError: Unexpected token '<'` in Angular
|
|
1055
1080
|
|
|
1056
1081
|
**Problem**: Angular returns HTML instead of JavaScript files from `node_modules`.
|
|
@@ -1075,7 +1100,8 @@ function App() {
|
|
|
1075
1100
|
|
|
1076
1101
|
- Verify file paths are correct
|
|
1077
1102
|
- Check browser console for errors
|
|
1078
|
-
- Ensure `
|
|
1103
|
+
- Ensure the script tag carries `type="module"` (see the `Unexpected token 'export'` entry above)
|
|
1104
|
+
- Ensure the `chunk-*.js` files sit next to `main.js` and are reachable (404s in the network tab)
|
|
1079
1105
|
|
|
1080
1106
|
## 🏠 Homepage
|
|
1081
1107
|
|