Ryderpro
Ryderpro

Reputation: 1315

React Office Fabric UI - Node Module can't resolve itself

import { MultiCount } from '@uifabric/dashboard';
I import the component and get this error.

Module not found: Error: Can't resolve '@uifabric/dashboard' in '/Users/jerry/Sites/office-ui-fabric-react/packages/dashboard/lib/components/Card/Layout'

The lib/component/Card/Layout.js ln14
import { MultiCount } from '@uifabric/dashboard';

The imported module gets the path right, but on import it can't resolve a import from itself? Updated the layout component to reference the folder instead of importing from itself, but that caused more build errors.

Any ideas how I can help this package self reference itself correctly? Webpack config change on the package?

https://github.com/OfficeDev/office-ui-fabric-react/tree/master/packages/dashboard

Upvotes: 0

Views: 1907

Answers (1)

Ryderpro
Ryderpro

Reputation: 1315

'@uifabric/dashboard$': path.join(__dirname, '../../packages/dashboard/src'),
Adding this to alias' in webpack.serve.config.js fixed this path import issue.

import { MultiCount } from '@uifabric/dashboard' works!

Upvotes: 0

Related Questions