Closed Lodjuret2001 closed 6 months ago
I had to use rollup to bundle my package and make chat-ui-kit-react as a external dependency.
After struggling a lot, I found a simple solution! I solved it by adding some stuff in vite.config.ts as below.
export default defineConfig({
...
optimizeDeps: {
include: ['prop-types'],
},
resolve: {
alias: {
'prop-types': 'prop-types/prop-types.js',
},
},
})
Hi there! I'm encountering an issue while trying to integrate my npm package, which depends on the
chat-ui-kit-react
package, into a Vite React project.Problem:
When testing my package in a Vite React project, I encounter a
SyntaxError
related to theprop-types
module. The error message indicates that the module does not provide a default export. Here's the specific error:Investigation:
Upon further investigation, I found that modifying the import statements within all files inside the "es", folder to use the wildcard import syntax.
(
import PropTypes from "prop-types" to ``import * as PropTypes from "prop-types"
) resolved the issue withprop-types
. (import classNames from "classnames" to ``import * as classNames from "classnames"
) resolved the issue withclassnames
.However, this led to a similar issue with the
@fortawesome/free-solid-svg-icons
module, where a specific export (faArrowDown
) could not be found.Next Steps:
I'm unsure how to proceed with resolving the issue related to
@fortawesome/free-solid-svg-icons
. I've ensured that all paths from my OpenReactBot component are correct and that all dependencies are correctly installed in the React app.Here is my links to my GitHub repositories for reference:
I would greatly appreciate any guidance or assistance on how to resolve this issue. Thank you for your help!