Skip to content

Commit

Permalink
Add support for Vite 5 (#9)
Browse files Browse the repository at this point in the history
* Add support vor Vite 5

* Try to fix paths

* Make noBundle imports relative instead of hacky

* Update README
  • Loading branch information
ManBearTM authored Mar 20, 2024
1 parent 96e140f commit ba26f9f
Show file tree
Hide file tree
Showing 26 changed files with 3,521 additions and 1,875 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm test
- run: npm run build
- run: npm publish
env:
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Run tests

on: [pull_request]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm test
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div align="center">

![](https://i.imgur.com/whutZeK.png)
![screenshot](https://i.imgur.com/whutZeK.png)

</div>

Expand All @@ -23,6 +23,8 @@ some of those gaps. πŸš€

![npm](https://img.shields.io/static/v1?style=for-the-badge&message=npm&color=CB3837&logo=npm&logoColor=FFFFFF&label=)

> From v4, `vite-plugin-no-bundle` requires **Vite 5**.
This plugin is designed to work with Vite in a development environment using
Node.js. You can install this package using npm, [Yarn], or [pnpm] using a
command similar to this example for npm:
Expand Down Expand Up @@ -57,7 +59,7 @@ export default defineConfig({

Here's an example project tree using ☝ the example `vite.config.ts` from above:

```
```text
.
β”œβ”€β”€ dist/
β”‚ β”œβ”€β”€ index.js
Expand Down Expand Up @@ -99,7 +101,7 @@ interface VitePluginNoBundleOptions {

- **`internal`:** One or more [globs] for matching files that should **not** be
automatically marked as external. This can be used to tell the plugin to
**not** handle certain files and leave them up to other plugins & resolvers.
**not** handle certain files and leave them up to other plugins and resolvers.

- **`root`:** Exposes [`output.preserveModulesRoot`], which controls which part
of the full path to exclude when putting files into the `dist/` folder. Make
Expand Down Expand Up @@ -143,12 +145,16 @@ Another good use-case is serving individual files via an HTTP server. Sometimes
you just want a plain TS ➑️ JS file conversion (with some extra features). This
plugin lets you do just that, no magic required. πŸ§™β€β™‚οΈ

πŸ“‚ **[Browse Sample Configurations](./samples)** - For practical examples,
explore the `samples` folder.

## Development

![TypeScript](https://img.shields.io/static/v1?style=for-the-badge&message=TypeScript&color=3178C6&logo=TypeScript&logoColor=FFFFFF&label=)

This is a fairly basic Vite plugin. The only compilation step is to run
`npm run build` which uses [tsup].
`npm run build` which uses [tsup]. Sample configurations serve as test
cases for different plugin scenarios and can be run using `npm test`.

If you're interested in learning more about Vite plugins and how they work,
check out the [Plugin API | Vite] page!
Expand All @@ -161,7 +167,6 @@ check out the [Plugin API | Vite] page!
[vitejs/vite#4454]: https://github.com/vitejs/vite/issues/4454
[tsup]: https://github.com/egoist/tsup#readme
[Plugin API | Vite]: https://vitejs.dev/guide/api-plugin.html
[@ManBearTM]: https://github.com/ManBearTM
[yarn]: https://yarnpkg.com/
[pnpm]: https://pnpm.io/
<!-- prettier-ignore-end -->
Loading

0 comments on commit ba26f9f

Please sign in to comment.