Skip to content

Commit 91975db

Browse files
committed
Webpack notes on README.md
1 parent a3913cc commit 91975db

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,38 @@ Note:
8989
'patternfly.charts'
9090
]);
9191

92+
### Using with Webpack
93+
94+
In order to use Angular-Patternfly in a Webpack-bundled application there are some things you need to keep in mind:
95+
96+
#### Create an alias for the jQuery module
97+
98+
In order to let Webpack find the correct jQuery module when assembling all the dependencies you need to create an alias for it in the webpack.conf.js file:
99+
100+
```
101+
...
102+
resolve: {
103+
alias: {
104+
"jquery": "angular-patternfly/node_modules/patternfly/node_modules/jquery"
105+
}
106+
}
107+
...
108+
```
109+
110+
Additionally, you have to use the `webpack.ProvidePlugin` so the $ and the jQuery variables are added to the `window` object, making them available to the other modules (Patternfly included):
111+
```
112+
...
113+
plugins: [
114+
new webpack.ProvidePlugin({
115+
$: "jquery",
116+
jQuery: "jquery",
117+
"window.jQuery": "jquery",
118+
"window.jquery": "jquery"
119+
})
120+
]
121+
...
122+
```
123+
92124
## API documentation
93125

94126
The API documentation can be built with:

0 commit comments

Comments
 (0)