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

Nested unlisted pages? #1188

Open
Bartek532 opened this issue Nov 19, 2024 · 3 comments
Open

Nested unlisted pages? #1188

Bartek532 opened this issue Nov 19, 2024 · 3 comments
Labels

Comments

@Bartek532
Copy link

Is it possible to nest unlisted page in some folder? E.g. I want to include auth in my extension, so I want to add auth folder and inside it define all the routes, how can I do it?

@breadgrocery
Copy link
Contributor

.
├── src
│   ├── entrypoints
│   │   ├── auth
│   │   │   ├──index.html
│   │   │   ├──main.ts
├── package.json

  • index.html
<script type="module" src="./main.ts"></script>

@Bartek532
Copy link
Author

.
├── src
│   ├── entrypoints
│   │   ├── auth
│   │   │   ├──index.html
│   │   │   ├──main.ts
├── package.json
  • index.html
<script type="module" src="./main.ts"></script>

Yes, that's good, but I want to nest pages under auth e.g. /auth/login or /auth/register

@breadgrocery
Copy link
Contributor

Yes, that's good, but I want to nest pages under auth e.g. /auth/login or /auth/register

.
├── src
│   ├── entrypoints
│   │   ├── auth
│   │   │   ├──login
│   │   │   │   ├──index.html
│   │   │   ├──register
│   │   │   │   ├──index.html
│   ├── modules
│   │   │   ├──my-entrypoints.ts  // filename doesn't matter
├── package.json
  • my-entrypoints.ts

This is a hard-coded example, implement the effect of glob by yourself.

import { resolve } from "node:path";
import { addEntrypoint, defineWxtModule } from "wxt/modules";

export default defineWxtModule(wxt => {
  addEntrypoint(wxt, {
    type: "unlisted-page",
    name: "auth/login",
    inputPath: resolve(wxt.config.entrypointsDir, "auth/login/index.html"),
    outputDir: resolve(wxt.config.outDir),
    skipped: false,
    options: {}
  });
  addEntrypoint(wxt, {
    type: "unlisted-page",
    name: "auth/register",
    inputPath: resolve(wxt.config.entrypointsDir, "auth/register/index.html"),
    outputDir: resolve(wxt.config.outDir),
    skipped: false,
    options: {}
  });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants