Skip to content

Commit

Permalink
fix: __dirname does not exist in ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
kibotrel committed Apr 21, 2022
1 parent 1f71308 commit 04696f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/api/src/express.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'node:path'
import process from 'node:process'
import { URL } from 'node:url'

import bodyParser from 'body-parser'
import cuid from 'cuid'
Expand All @@ -14,6 +15,8 @@ import logRequest from '#src/middleware/log-request.js'
import session from '#src/middleware/session.js'
import routes from '#src/routes/index.js'

const __dirname = new URL('.', import.meta.url).pathname

const setRequestId = (req, res, next) => {
const requestId = cuid()
res.set('X-RequestId', requestId)
Expand Down
3 changes: 3 additions & 0 deletions apps/front/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { URL } from 'node:url'

const __dirname = new URL('.', import.meta.url).pathname

export default defineConfig({
plugins: [vue()],
Expand Down

0 comments on commit 04696f1

Please sign in to comment.