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

Simplify simple example for codesandbox #8694

Merged
merged 3 commits into from
Mar 2, 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
40 changes: 0 additions & 40 deletions examples/simple/index-webpack.html

This file was deleted.

13 changes: 2 additions & 11 deletions examples/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"version": "4.8.1",
"private": true,
"scripts": {
"dev": "webpack-dev-server --progress --color --hot --mode development",
"start": "vite",
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"type-check": "tsc --noEmit"
Expand Down Expand Up @@ -35,16 +34,8 @@
"@babel/preset-react": "^7.12.10",
"@hookform/devtools": "^4.0.2",
"@vitejs/plugin-react": "^2.2.0",
"html-loader": "~3.1.0",
"html-webpack-plugin": "~5.5.0",
"ignore-not-found-export-plugin": "^1.0.1",
"react-app-polyfill": "^1.0.4",
"style-loader": "~3.3.1",
"ts-loader": "^9.2.8",
"typescript": "^4.4.0",
"vite": "^3.2.0",
"webpack": "~5.70.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "~4.7.4"
"vite": "^3.2.0"
}
}
2 changes: 1 addition & 1 deletion examples/simple/sandbox.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"view": "browser",
"template": "node",
"container": {
"node": "14"
"node": "16"
}
}
35 changes: 20 additions & 15 deletions examples/simple/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@ import react from '@vitejs/plugin-react';
import path from 'path';
import fs from 'fs';

const packages = fs.readdirSync(path.resolve(__dirname, '../../packages'));
const aliases = packages.map(dirName => {
const packageJson = require(path.resolve(
__dirname,
'../../packages',
dirName,
'package.json'
));
return {
find: new RegExp(`^${packageJson.name}$`),
replacement: path.resolve(
// In codesandbox, we won't have the packages folder
// We ignore errors in this case
let aliases = [];
try {
const packages = fs.readdirSync(path.resolve(__dirname, '../../packages'));
aliases = packages.map(dirName => {
const packageJson = require(path.resolve(
__dirname,
`../../packages/${packageJson.name}/src`
),
};
}, {});
'../../packages',
dirName,
'package.json'
));
return {
find: new RegExp(`^${packageJson.name}$`),
replacement: path.resolve(
__dirname,
`../../packages/${packageJson.name}/src`
),
};
}, {});
} catch {}

/**
* https://vitejs.dev/config/
Expand Down
48 changes: 0 additions & 48 deletions examples/simple/webpack.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"doc": "cd docs && jekyll server . --watch",
"lint": "eslint --ext .js,.ts,.tsx \"./packages/**/src/**/*.{js,ts,tsx}\" \"./examples/**/src/**/*.{js,ts,tsx}\" \"./cypress/**/*.{js,ts,tsx}\"",
"prettier": "prettier --config ./.prettierrc.js --write --list-different \"packages/*/src/**/*.{js,json,ts,tsx,css,md}\" \"examples/*/src/**/*.{js,ts,json,tsx,css,md}\" \"cypress/**/*.{js,ts,json,tsx,css,md}\"",
"run-simple": "cd examples/simple && yarn start",
"run-simple": "cd examples/simple && yarn dev",
"run-no-code": "cd examples/no-code && yarn dev",
"run-tutorial": "cd examples/tutorial && yarn dev",
"run-demo": "cd examples/demo && cross-env REACT_APP_DATA_PROVIDER=rest yarn dev",
Expand Down
Loading