From 175d79325078fa662ef49367c66590b054196cb7 Mon Sep 17 00:00:00 2001 From: John Dunning Date: Thu, 23 Mar 2023 15:30:44 -0700 Subject: [PATCH] Add shared/index.js Avoids having to use ../shared in optimizeDeps inside vite.config.js. --- client/vite.config.js | 4 ++-- shared/index.js | 4 ++++ shared/package.json | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 shared/index.js diff --git a/client/vite.config.js b/client/vite.config.js index 9e0f645d..81580ee2 100644 --- a/client/vite.config.js +++ b/client/vite.config.js @@ -62,8 +62,8 @@ export default defineConfig({ optimizeDeps: { include: [ 'uswds', - '../shared/metadata', - '../shared/constants' + 'shared/constants', + 'shared/metadata' ], esbuildOptions: { loader: { diff --git a/shared/index.js b/shared/index.js new file mode 100644 index 00000000..14d3d9e9 --- /dev/null +++ b/shared/index.js @@ -0,0 +1,4 @@ +exports = { + ...require('./constants'), + ...require('./metadata') +}; diff --git a/shared/package.json b/shared/package.json index a5b68bd5..e3f60822 100644 --- a/shared/package.json +++ b/shared/package.json @@ -9,6 +9,7 @@ "metadata" ], "exports": { + ".": "./index.js", "./constants": "./constants/index.js", "./metadata": "./metadata/index.js", "./metadata/*": "./metadata/*.js"