-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: upgraded remix compiler to remix vite #274
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
/// <reference types="@remix-run/dev" /> | ||
/// <reference types="vite/client" /> | ||
/// <reference types="@remix-run/node" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
{ | ||
"name": "indie-stack-template", | ||
"type": "module", | ||
"private": true, | ||
"sideEffects": false, | ||
"scripts": { | ||
"build": "remix build", | ||
"dev": "remix dev -c \"npm run dev:serve\"", | ||
"dev:serve": "binode --require ./mocks -- @remix-run/serve:remix-serve ./build/index.js", | ||
"build": "remix vite:build", | ||
"dev": "remix vite:dev", | ||
"format": "prettier --write .", | ||
"format:repo": "npm run format && npm run lint -- --fix", | ||
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .", | ||
"setup": "prisma generate && prisma migrate deploy && prisma db seed", | ||
"start": "remix-serve ./build/index.js", | ||
"start:mocks": "binode --require ./mocks -- @remix-run/serve:remix-serve ./build/index.js", | ||
"start": "remix-serve ./build/server/index.js", | ||
"start:mocks": "binode --import ./mocks/index.js -- @remix-run/serve:remix-serve ./build/server/index.js", | ||
"test": "vitest", | ||
"test:e2e:dev": "start-server-and-test dev http://localhost:3000 \"npx cypress open\"", | ||
"pretest:e2e:run": "npm run build", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. facing issues while running Tried updating There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've migrated an Indie Stack application to vite. Regarding your issue I ended up switching to -cy.exec(
- `npx ts-node -r tsconfig-paths/register ./cypress/support/create-user.ts "${email}"`,
-).then(({ stdout }) => {
- const cookieValue = stdout
- .replace(/.*<cookie>(?<cookieValue>.*)<\/cookie>.*/s, "$<cookieValue>")
- .trim();
- cy.setCookie("__session", cookieValue);
-});
+cy.exec(`tsx ./cypress/support/create-user.ts "${email}"`).then(
+ ({ stdout }) => {
+ const cookieValue = stdout
+ .replace(/.*<cookie>(?<cookieValue>.*)<\/cookie>.*/s, "$<cookieValue>")
+ .trim();
+ cy.setCookie("__session", cookieValue);
+ },
+);
-cy.exec(
- `npx ts-node -r tsconfig-paths/register ./cypress/support/delete-user.ts "${email}"`,
-);
+cy.exec(`tsx ./cypress/support/delete-user.ts "${email}"`); And "scripts": {
"build": "remix vite:build",
"dev": "binode --import ./mocks/index.js -- @remix-run/dev:remix vite:dev",
"format": "prettier --write .",
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
"setup": "prisma generate && prisma migrate deploy && prisma db seed",
"start": "remix-serve ./build/server/index.js",
"start:mocks": "binode --import ./mocks/index.js -- @remix-run/serve:remix-serve ./build/server/index.js",
"test": "vitest",
"test:e2e:dev": "start-server-and-test dev http://localhost:3000 \"npx cypress open\"",
"pretest:e2e:run": "npm run build",
"test:e2e:run": "cross-env PORT=8811 start-server-and-test start:mocks http://localhost:8811 \"npx cypress run\"",
"typecheck": "tsc && tsc -p cypress",
"validate": "run-p \"test -- --run\" lint typecheck test:e2e:run",
"prisma:studio": "prisma studio",
"optimize:images": "tsx app/optimize-images.ts"
}, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Apsysikal, thanks for the input. I tried There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you confirm what shell are you using? I read there's some issue with zsh in particular with Cypress There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also got an error (different one) but fixed it on my end. I used bash. The changes made (should also probably update the comment) are:
-// npx ts-node -r tsconfig-paths/register ./cypress/support/create-user.ts username@example.com,
+// npx tsx ./cypress/support/create-user.ts username@example.com,
-// npx ts-node -r tsconfig-paths/register ./cypress/support/delete-user.ts username@example.com,
+// npx tsx ./cypress/support/delete-user.ts username@example.com,
-import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
+import { Prisma } from "@prisma/client";
-error instanceof PrismaClientKnownRequestError &&
+error instanceof Prisma.PrismaClientKnownRequestError && You should also add tsx to the
+"tsx": "^4.9.1", |
||
|
@@ -27,7 +27,6 @@ | |
], | ||
"dependencies": { | ||
"@prisma/client": "^4.16.2", | ||
"@remix-run/css-bundle": "*", | ||
"@remix-run/node": "*", | ||
"@remix-run/react": "*", | ||
"@remix-run/serve": "*", | ||
|
@@ -80,14 +79,14 @@ | |
"ts-node": "^10.9.1", | ||
"tsconfig-paths": "^4.2.0", | ||
"typescript": "^5.2.2", | ||
"vite": "^4.5.0", | ||
"vite": "^5.1.6", | ||
"vite-tsconfig-paths": "^4.2.1", | ||
"vitest": "^0.34.6" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
"prisma": { | ||
"seed": "ts-node -r tsconfig-paths/register prisma/seed.ts" | ||
"seed": "ts-node-esm -r tsconfig-paths/register prisma/seed.ts" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we want to use 'tsx' this could also just be moved to it. So it would become: "seed": "tsx prisma/seed.ts" |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { vitePlugin as remix } from "@remix-run/dev"; | ||
import { installGlobals } from "@remix-run/node"; | ||
import { defineConfig } from "vite"; | ||
import tsconfigPaths from "vite-tsconfig-paths"; | ||
|
||
installGlobals(); | ||
|
||
export default defineConfig({ | ||
server: { | ||
port: 3000, | ||
}, | ||
plugins: [ | ||
remix({ | ||
ignoredRouteFiles: ["**/*.css"], | ||
}), | ||
tsconfigPaths(), | ||
], | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively we could also do:
I don't know if there is a preferred way though. I just used it like that.