I am using React + Javascript + Vite for the project. I installed the required packages for the project , Also i install one package from local npm installation eg
npm install source_folder
The local package which is a component library , after this installation i import the component and npm run dev
is working fine. But
npm run build
failing with below error
✓ 34 modules transformed.
x Build failed in 751ms
error during build:
src/App.jsx (3:9): "Button" is not exported by "../../BCL-UI/dist/index.js", imported by "src/App.jsx".
file: /Users/user1/workspace/projects/poc/chat-app/src/App.jsx:3:9
here BCL-UI is the local package installed, Below is the vite configuration
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
optimizeDeps: {
include: ['bcl-ui'],
},
})
package.json below
"dependencies": {
"axl-ui": "file:../../BCL-UI",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
Note : Only the npm run build
is failed and npm run dev
is working fine