@@ -25,8 +25,8 @@ npm install js-component-framework
2525Below is a basic set up for using the component framework without the included Aria plugins:
2626
2727``` javascript
28- // Import only the core component framework library .
29- import { Component } from ' js-component-framework/core ' ;
28+ // Import the ES modules to be consumed by a bundler such as webpack append the '/es' to the end of the import statement .
29+ import { Component } from ' js-component-framework/es ' ;
3030
3131/**
3232 * Custom component which extends the base component class.
@@ -42,12 +42,11 @@ class MyComponent extends Component {
4242}
4343```
4444
45- If you also want to use the entire framework with the bundled Aria plugins use the default import:
45+ If you also want to use the entire framework using the CommonJS bundled scripts with Aria plugins use the default import:
4646``` js
4747import { Component , plugins } from ' js-component-framework' ;
4848```
4949
50-
5150## Best practices for creating components
5251
5352### Create one directory per component
@@ -74,6 +73,11 @@ To create a component, do the following at the top of the file:
7473import { Component } from ' js-component-framework' ;
7574```
7675
76+ If you are compiling your code with a bundler like webpack, only import what you need for a smaller footprint:
77+ ``` js
78+ import { Component } from ' js-component-framework/es' ;
79+ ```
80+
7781When writing a component class, are some rules you need to follow and some guidelines:
7882
7983* You _ must_ provide a constructor. At minimum, the constructor should look like the following:
@@ -96,7 +100,7 @@ Generally speaking, you'll want to instantiate your component in the footer or o
96100
97101``` js
98102
99- import { ComponentManager } from ` js-component-framework` ;
103+ import { ComponentManager } from ` js-component-framework/es ` ;
100104import headerConfig from ` ./Components/Header` ;
101105
102106// Instantiate manager
0 commit comments