Skip to content

Commit 7ebeacc

Browse files
feat: move to ESM (#255)
1 parent 2a1e69e commit 7ebeacc

9 files changed

+14
-15
lines changed

.eslintrc.js .eslintrc.cjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ module.exports = {
110110
},
111111
settings: {
112112
jest: {
113-
// we're using vitest which has a very similar API to jest
114-
// (so the linting plugins work nicely), but it means we have to explicitly
115-
// set the jest version.
113+
// We're using vitest which has a very similar API to jest
114+
// (so the linting plugins work nicely), but it means we
115+
// have to set the jest version explicitly.
116116
version: 28,
117117
},
118118
},

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ This project uses TypeScript. It's recommended to get TypeScript set up for your
176176

177177
### Linting
178178

179-
This project uses ESLint for linting. That is configured in `.eslintrc.js`.
179+
This project uses ESLint for linting. That is configured in `.eslintrc.cjs`.
180180

181181
### Formatting
182182

File renamed without changes.

mocks/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const { http, passthrough } = require("msw");
2-
const { setupServer } = require("msw/node");
1+
import { http, passthrough } from "msw";
2+
import { setupServer } from "msw/node";
33

44
// put one-off handlers that don't really need an entire file to themselves here
55
const miscHandlers = [

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
"name": "indie-stack-template",
33
"private": true,
44
"sideEffects": false,
5+
"type": "module",
56
"scripts": {
67
"build": "remix build",
78
"dev": "remix dev -c \"npm run dev:serve\"",
8-
"dev:serve": "binode --require ./mocks -- @remix-run/serve:remix-serve ./build/index.js",
9+
"dev:serve": "NODE_OPTIONS=\"--import ./mocks/index.js\" remix-serve ./build/index.js",
910
"format": "prettier --write .",
1011
"format:repo": "npm run format && npm run lint -- --fix",
1112
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
1213
"setup": "prisma generate && prisma migrate deploy && prisma db seed",
1314
"start": "remix-serve ./build/index.js",
14-
"start:mocks": "binode --require ./mocks -- @remix-run/serve:remix-serve ./build/index.js",
15+
"start:mocks": "NODE_OPTIONS=\"--import ./mocks/index.js\" remix-serve ./build/index.js",
1516
"test": "vitest",
1617
"test:e2e:dev": "start-server-and-test dev http://localhost:3000 \"npx cypress open\"",
1718
"pretest:e2e:run": "npm run build",
@@ -52,7 +53,6 @@
5253
"@vitejs/plugin-react": "^4.3.1",
5354
"@vitest/coverage-v8": "^2.0.5",
5455
"autoprefixer": "^10.4.20",
55-
"binode": "^1.0.5",
5656
"cookie": "^0.6.0",
5757
"cross-env": "^7.0.3",
5858
"cypress": "^13.14.2",
@@ -80,7 +80,7 @@
8080
"tsx": "^4.19.0",
8181
"typescript": "^5.6.2",
8282
"vite": "^5.4.3",
83-
"vite-tsconfig-paths": "^4.3.2",
83+
"vite-tsconfig-paths": "^5.0.1",
8484
"vitest": "^2.0.5"
8585
},
8686
"engines": {

postcss.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
plugins: {
33
tailwindcss: {},
44
autoprefixer: {},

prettier.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/** @type {import("prettier").Config} */
2-
module.exports = {
2+
export default {
33
plugins: ["prettier-plugin-tailwindcss"],
44
};

remix.config.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/** @type {import('@remix-run/dev').AppConfig} */
2-
module.exports = {
2+
export default {
33
cacheDirectory: "./node_modules/.cache/remix",
44
ignoredRouteFiles: ["**/.*", "**/*.test.{ts,tsx}"],
5-
serverModuleFormat: "cjs",
65
};

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"isolatedModules": true,
88
"esModuleInterop": true,
99
"jsx": "react-jsx",
10-
"module": "CommonJS",
10+
"module": "ES2020",
1111
"moduleResolution": "node",
1212
"resolveJsonModule": true,
1313
"target": "ES2020",

0 commit comments

Comments
 (0)