Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with import-map-overrides #15

Merged
merged 5 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build and Test

on:
push:
branches: main
pull_request:
branches: "*"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
- uses: pnpm/action-setup@v4
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- run: pnpm test
- run: pnpm run check-format
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,21 @@ When using external import maps, import-map-injector must wait for the network r
});
</script>
```

## Compatibility

import-map-injector is compatible with [import-map-overrides@>=4.1.0](https://github.com/single-spa/import-map-overrides) via an in-code integration. To use the two projects together, do the following:

1. Load import-map-overrides.js **before** import-map-injector.js

```html
<!-- overrides before injector. [email protected] or greater required -->
<script src="import-map-overrides.js"></script>
<script src="import-map-injector.js"></script>
```

2. Add the `use-injector` attribute to the `<meta name="importmap-type">` element that configures import-map-overrides. See [import-map-overrides docs](https://github.com/single-spa/import-map-overrides/blob/main/docs/configuration.md#import-map-type) for more details

```html
<meta name="importmap-type" use-injector />
```
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"format": "prettier --write .",
"check-format": "prettier --check .",
"watch": "rollup -cw",
"test": "echo \"No tests\"",
"test-serve": "node fixtures/server.js",
"build": "concurrently pnpm:build:*",
"prepublishOnly": "pnpm run build",
Expand All @@ -47,5 +48,6 @@
"prettier": "^3.0.2",
"rollup": "^3.28.0",
"typescript": "^5.1.6"
}
},
"packageManager": "[email protected]"
}
Loading