Skip to content

Commit 4d35785

Browse files
authored
Merge pull request #351 from lorthirk/webpackReadme
Webpack notes on README.md
2 parents b88cf40 + 577d9ad commit 4d35785

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
@@ -93,6 +93,38 @@ Note:
9393
'patternfly.charts'
9494
]);
9595

96+
### Using with Webpack
97+
98+
In order to use Angular-Patternfly in a Webpack-bundled application there are some things you need to keep in mind:
99+
100+
#### Create an alias for the jQuery module
101+
102+
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:
103+
104+
```
105+
...
106+
resolve: {
107+
alias: {
108+
"jquery": "angular-patternfly/node_modules/patternfly/node_modules/jquery"
109+
}
110+
}
111+
...
112+
```
113+
114+
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):
115+
```
116+
...
117+
plugins: [
118+
new webpack.ProvidePlugin({
119+
$: "jquery",
120+
jQuery: "jquery",
121+
"window.jQuery": "jquery",
122+
"window.jquery": "jquery"
123+
})
124+
]
125+
...
126+
```
127+
96128
## API documentation
97129

98130
The API documentation can be built with:

0 commit comments

Comments
 (0)