fission-codes / kit

UI Kit for Fission projects
https://kit.fission.app
Apache License 2.0
8 stars 1 forks source link

React components don't resolve with CRA / webpack 4 #3

Open walkah opened 3 years ago

walkah commented 3 years ago

Using create-react-app (with the included webpack 4), trying to add a <SignInButton /> component fails to import:

Module not found: Can't resolve '@fission-suite/kit/components/react' in '/Users/walkah/Projects/fission-suite/blog/src/components'

Relevant code is:

import { SignInButton } from "@fission-suite/kit/components/react";
icidasset commented 3 years ago

Webpack 4 doesn't support the exports map (see https://github.com/webpack/webpack/issues/9509) (more info about exports https://docs.skypack.dev/package-authors/package-checks#export-map)

In that case you can do the following import instead:

import { SignInButton } from "@fission-suite/kit/src/Components/React/index.js"

(you might be able to drop the /index.js)

If you need to do this with require, replace src with lib.