Skip to content

Commit

Permalink
Update Vite's Node API to ESM from CJS build (#155)
Browse files Browse the repository at this point in the history
This PR resolves the warning message that occurs when running npm run
dev or npm run build in Vite. The warning message states that the CJS
build of Vite's Node API is deprecated and provides instructions on
how to address the issue by switching to ESM.

https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated
  • Loading branch information
chacha912 authored Jun 25, 2024
1 parent e79e391 commit aa81c24
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 458 deletions.
12 changes: 6 additions & 6 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ version: v1
plugins:
- plugin: es
out: .
opt:
- target=js+dts
- js_import_style=legacy_commonjs
opt:
- target=js+dts
- js_import_style=module
- plugin: connect-es
out: .
opt:
- target=js+dts
- js_import_style=legacy_commonjs
opt:
- target=js+dts
- js_import_style=module
30 changes: 30 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"name": "dashboard",
"version": "0.4.23",
"private": true,
"type": "module",
"homepage": "https://yorkie.dev/dashboard",
"dependencies": {
"@buf/googleapis_googleapis.connectrpc_es": "^1.4.0-20240524201209-f0e53af8f2fc.3",
"@bufbuild/buf": "^1.34.0",
"@bufbuild/protobuf": "^1.10.0",
"@bufbuild/protoc-gen-es": "^1.10.0",
Expand Down
2 changes: 1 addition & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
plugins: {
autoprefixer: {},
},
Expand Down
2 changes: 1 addition & 1 deletion src/api/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
Change as PbChange,
} from './yorkie/v1/resources_pb';
import { ConnectError } from '@connectrpc/connect';
import { BadRequest } from './yorkie/v1/error_details_pb';
import { BadRequest } from '@buf/googleapis_googleapis.bufbuild_es/google/rpc/error_details_pb';

export function fromTimestamp(pbTimestamp: PbTimestamp): number {
return pbTimestamp.toDate().getTime() / 1000;
Expand Down
2 changes: 1 addition & 1 deletion src/api/yorkie/v1/admin_connect.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-connect-es v1.2.0 with parameter "target=js+dts,js_import_style=legacy_commonjs"
// @generated by protoc-gen-connect-es v1.4.0 with parameter "target=js+dts,js_import_style=module"
// @generated from file src/api/yorkie/v1/admin.proto (package yorkie.v1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
13 changes: 4 additions & 9 deletions src/api/yorkie/v1/admin_connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-connect-es v1.2.0 with parameter "target=js+dts,js_import_style=legacy_commonjs"
// @generated by protoc-gen-connect-es v1.4.0 with parameter "target=js+dts,js_import_style=module"
// @generated from file src/api/yorkie/v1/admin.proto (package yorkie.v1, syntax proto3)
/* eslint-disable */
// @ts-nocheck

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

const { CreateProjectRequest, CreateProjectResponse, GetDocumentRequest, GetDocumentResponse, GetProjectRequest, GetProjectResponse, GetSnapshotMetaRequest, GetSnapshotMetaResponse, ListChangesRequest, ListChangesResponse, ListDocumentsRequest, ListDocumentsResponse, ListProjectsRequest, ListProjectsResponse, LogInRequest, LogInResponse, RemoveDocumentByAdminRequest, RemoveDocumentByAdminResponse, SearchDocumentsRequest, SearchDocumentsResponse, SignUpRequest, SignUpResponse, UpdateProjectRequest, UpdateProjectResponse } = require("./admin_pb.js");
const { MethodKind } = require("@bufbuild/protobuf");
import { CreateProjectRequest, CreateProjectResponse, GetDocumentRequest, GetDocumentResponse, GetProjectRequest, GetProjectResponse, GetSnapshotMetaRequest, GetSnapshotMetaResponse, ListChangesRequest, ListChangesResponse, ListDocumentsRequest, ListDocumentsResponse, ListProjectsRequest, ListProjectsResponse, LogInRequest, LogInResponse, RemoveDocumentByAdminRequest, RemoveDocumentByAdminResponse, SearchDocumentsRequest, SearchDocumentsResponse, SignUpRequest, SignUpResponse, UpdateProjectRequest, UpdateProjectResponse } from "./admin_pb.js";
import { MethodKind } from "@bufbuild/protobuf";

/**
* Admin is a service that provides a API for Admin.
*
* @generated from service yorkie.v1.AdminService
*/
const AdminService = {
export const AdminService = {
typeName: "yorkie.v1.AdminService",
methods: {
/**
Expand Down Expand Up @@ -143,5 +140,3 @@ const AdminService = {
}
};


exports.AdminService = AdminService;
2 changes: 1 addition & 1 deletion src/api/yorkie/v1/admin_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-es v1.6.0 with parameter "target=js+dts,js_import_style=legacy_commonjs"
// @generated by protoc-gen-es v1.10.0 with parameter "target=js+dts,js_import_style=module"
// @generated from file src/api/yorkie/v1/admin.proto (package yorkie.v1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
Loading

0 comments on commit aa81c24

Please sign in to comment.