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

docs(react): v7 playgrounds use vite #3236

Merged
merged 4 commits into from
Nov 9, 2023
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
8 changes: 7 additions & 1 deletion src/components/global/Playground/stackblitz.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ const openReactEditor = async (code: string, options?: EditorOptions) => {
'react/package.json',
'react/package-lock.json',
'react/index.html',
'react/vite.config.js',
'react/browserslistrc',
'react/eslintrc.js',
],
options.version
);
Expand All @@ -194,7 +197,10 @@ const openReactEditor = async (code: string, options?: EditorOptions) => {

const appTsx = 'src/App.tsx';
const files = {
'public/index.html': defaultFiles[6],
'.eslintrc.js': defaultFiles[9],
'.browserslistrc': defaultFiles[8],
'vite.config.js': defaultFiles[7],
'index.html': defaultFiles[6],
'src/index.tsx': defaultFiles[0],
[appTsx]: defaultFiles[1],
'src/main.tsx': code,
Expand Down
7 changes: 7 additions & 0 deletions static/code/stackblitz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ This directory contains the source files for generating the individual framework
| `main.js` | Initializes Ionic Vue and imports global styles. |
| `package.json` | Project specific dependencies to create an example with Vite. |
| `vite.config.js` | Vite configuration file. |


## Dotfiles

Dotfiles must be saved without the dot otherwise they will not be fetched correctly. However, when creating the StackBlitz project the dot can be used.

For example, if you had an `.eslintrc.js` file you would save it as `eslintrc.js` in this repo. When creating the StackBlitz project the contents of that file can then be saved as `.eslintrc.js`
6 changes: 6 additions & 0 deletions static/code/stackblitz/v7/react/browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Chrome >=79
ChromeAndroid >=79
Firefox >=70
Edge >=79
Safari >=14
iOS >=14
17 changes: 17 additions & 0 deletions static/code/stackblitz/v7/react/eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:react/recommended',
'eslint:recommended'
],
parserOptions: {
ecmaVersion: 2020
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
}
}
26 changes: 22 additions & 4 deletions static/code/stackblitz/v7/react/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<meta charset="utf-8" />
<title>Ionic App</title>

<base href="/" />

<div id="root"></div>
<meta name="color-scheme" content="light dark" />
<meta
name="viewport"
content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />

<!-- add to homescreen for ios -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="Ionic App" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
</head>
brandyscarney marked this conversation as resolved.
Show resolved Hide resolved
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
Loading
Loading