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

Fix: Adding correct projectType for VitePlugin docs #925

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -1,57 +1,26 @@
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

## Create a project

Use your favorite package manager to scaffold a new project and follow the
prompts to create a vanilla JS project.

<Tabs groupId='vite-version'>
<TabItem value='vite2' label='Vite 2' default>

```sh
npm init vite@^2.9.4
```

</TabItem>
<TabItem value='vite3' label='Vite 3 (beta)'>

```sh
npm init vite@latest
```

:::info beta

CRXJS support for Vite 3 is in beta.

:::

:::info react users

HMR in CRXJS is incompatible with `@vite/plugin-react-swc`. We recommend using @vitejs/plugin-react instead.

:::

</TabItem>
</Tabs>

## Install CRXJS Vite plugin

Now install the CRXJS Vite plugin using your favorite package manager.

<Tabs groupId='vite-version'>
<TabItem value='vite2' label='Vite 2' default>

```sh
npm i @crxjs/vite-plugin@latest -D
```

</TabItem>
<TabItem value='vite3' label='Vite 3 (beta)'>

```sh
npm i @crxjs/vite-plugin@beta -D
```

</TabItem>
</Tabs>
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Admonition from '@theme/Admonition';

export const CreateProjectTabs = ({ projectType }) =>
<>
<p>Use your favorite package manager to scaffold a new project and follow the prompts to create a {projectType} project.</p>
<Tabs groupId='vite-version'>
<TabItem value='vite2' label='Vite 2' default>
<pre>
<code>npm init vite@^2.9.4</code>
</pre>
</TabItem>
<TabItem value='vite3' label='Vite 3 (beta)'>
<pre>
<code>npm init vite@latest</code>
</pre>
<Admonition type="info" title="beta">
CRXJS support for Vite 3 is in beta.
</Admonition>
<Admonition type="info" title="React Users">
HMR in CRXJS is incompatible with <code>@vite/plugin-react-swc</code>. We recommend using <code>@vitejs/plugin-react</code> instead.
</Admonition>
</TabItem>
</Tabs>
</>
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ pagination_prev: null
slug: create-project
---

import CreateProjectTabs from '../\_create-project-tabs.mdx'
import {CreateProjectTabs} from '../\_create-project-tabs.mdx'

# Get Started with React

This quick guide will get you up and running with a Chrome Extension popup page.
You'll see how to integrate CRXJS with Vite, then explore Vite HMR in an
extension React HTML page. The first two sections take about 90 seconds!

<CreateProjectTabs />
<CreateProjectTabs projectType="react"/>

## Update the Vite config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tags:
pagination_prev: null
---

import CreateProjectTabs from '../\_create-project-tabs.mdx'
import {CreateProjectTabs} from '../\_create-project-tabs.mdx'

# Get Started with Vanilla JS

Expand All @@ -27,7 +27,7 @@ reload.

:::

<CreateProjectTabs />
<CreateProjectTabs projectType="vanilla JS"/>

## Create a Vite config file

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ pagination_prev: null
slug: create-project
---

import CreateProjectTabs from '../\_create-project-tabs.mdx'
import {CreateProjectTabs} from '../\_create-project-tabs.mdx'

# Get Started with Vue

This quick guide will get you up and running with a Chrome Extension popup page.
You'll see how to integrate CRXJS with Vite, then explore Vite HMR in an
extension Vue HTML page. The first two sections take about 90 seconds!

<CreateProjectTabs />
<CreateProjectTabs projectType="vue"/>

:::tip package.json

Expand Down