Skip to content

Commit

Permalink
Compatibility with import-map-overrides (#15)
Browse files Browse the repository at this point in the history
* Compatibility with import-map-overrides

* More files

* Documentation

* Add test script

* Clarify version of import-map-overrides
  • Loading branch information
joeldenning authored Oct 2, 2024
1 parent 7eea9dc commit caa5bc9
Show file tree
Hide file tree
Showing 5 changed files with 2,019 additions and 1,604 deletions.
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

0 comments on commit caa5bc9

Please sign in to comment.