Skip to content

Commit

Permalink
Undo ajv8 alias and fix Vite dev server (#3371)
Browse files Browse the repository at this point in the history
* Re-fix #3228 and related follow-up issues
- Upgrade vite to 4.0.4
- Remove ajv8 alias for validator-ajv8 (will fix issues in skypack)
- Change vite mode to production (fixes issue where vite/esbuild mix up ajv v6 and v8)

* Update lockfile

* `preserveSymlinks` seems to fix rather than changing `mode`

* Update CHANGELOG
  • Loading branch information
nickgros authored Jan 14, 2023
1 parent 182d135 commit b242804
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 36 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ it according to semantic versioning. For example, if your PR adds a breaking cha
should change the heading of the (upcoming) version to include a major version bump.
-->
# 5.0.0-beta-17

## @rjsf/playground
- Change Vite `preserveSymlinks` to `true`, which provides an alternative fix for [#3228](https://github.com/rjsf-team/react-jsonschema-form/issues/3228) since the prior fix caused [#3215](https://github.com/rjsf-team/react-jsonschema-form/issues/3215).

## @rjsf/validator-ajv8
- Remove alias for ajv -> ajv8 in package.json. This fixes [#3215](https://github.com/rjsf-team/react-jsonschema-form/issues/3215).

# 5.0.0-beta-16

## @rjsf/antd
Expand Down
1 change: 1 addition & 0 deletions packages/playground/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default defineConfig({
}, // maintain the old webpack behavior in dev
plugins: [react()],
resolve: {
preserveSymlinks: true, // Fixes https://github.com/rjsf-team/react-jsonschema-form/issues/3228
alias: {
// The following is needed to allow the material ui v4 and v5 themes to properly load the css
"@mui/styles": path.resolve("./node_modules", "@mui/styles"),
Expand Down
29 changes: 1 addition & 28 deletions packages/validator-ajv8/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/validator-ajv8/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"dependencies": {
"ajv-formats": "^2.1.1",
"ajv8": "npm:ajv@^8.11.0",
"ajv": "^8.11.0",
"lodash": "^4.17.15",
"lodash-es": "^4.17.15"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/validator-ajv8/src/createAjvInstance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ajv, { Options } from "ajv8";
import Ajv, { Options } from "ajv";
import addFormats, { FormatsPluginOptions } from "ajv-formats";
import isObject from "lodash/isObject";

Expand Down
2 changes: 1 addition & 1 deletion packages/validator-ajv8/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ajv, { Options, ErrorObject } from "ajv8";
import Ajv, { Options, ErrorObject } from "ajv";
import { FormatsPluginOptions } from "ajv-formats";

/** The type describing how to customize the AJV6 validator
Expand Down
2 changes: 1 addition & 1 deletion packages/validator-ajv8/src/validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ajv, { ErrorObject, ValidateFunction } from "ajv8";
import Ajv, { ErrorObject, ValidateFunction } from "ajv";
import toPath from "lodash/toPath";
import isObject from "lodash/isObject";
import clone from "lodash/clone";
Expand Down
8 changes: 4 additions & 4 deletions packages/validator-ajv8/test/createAjvInstance.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ajv from "ajv8";
import Ajv2019 from "ajv8/dist/2019";
import Ajv from "ajv";
import Ajv2019 from "ajv/dist/2019";
import addFormats from "ajv-formats";

import createAjvInstance, {
Expand All @@ -9,8 +9,8 @@ import createAjvInstance, {
} from "../src/createAjvInstance";
import { CustomValidatorOptionsType } from "../src";

jest.mock("ajv8");
jest.mock("ajv8/dist/2019");
jest.mock("ajv");
jest.mock("ajv/dist/2019");
jest.mock("ajv-formats");

export const CUSTOM_OPTIONS: CustomValidatorOptionsType = {
Expand Down

0 comments on commit b242804

Please sign in to comment.