Skip to content

Commit d91c178

Browse files
authored
Update the steps to use webpack
1 parent 9909b1a commit d91c178

File tree

1 file changed

+25
-5
lines changed
  • articles/communication-services/quickstarts/chat/includes

1 file changed

+25
-5
lines changed

articles/communication-services/quickstarts/chat/includes/chat-js.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,25 @@ The `--save` option lists the library as a dependency in your **package.json** f
6060

6161
### Set up the app framework
6262

63-
This article uses parcel to bundle the application assets. Run the following command to install it and list it as a development dependency in your **package.json**:
63+
This article uses webpack to bundle the application assets. Run the following command to install it and list it as a development dependency in your **package.json**:
6464

6565
```console
66-
npm install parcel --save-dev
66+
npm install webpack webpack-cli webpack-dev-server --save-dev
6767
```
68+
69+
Create a **webpack.config.js** in the root directory of your project.
70+
71+
```js
72+
module.exports = {
73+
entry: "./client.js",
74+
output: {
75+
filename: "bundle.js"
76+
},
77+
devtool: "inline-source-map",
78+
mode: "development"
79+
}
80+
```
81+
6882
Create an **index.html** file in the root directory of your project. Use this file as a template to add chat capability using the Azure Communication Chat SDK for JavaScript.
6983

7084
```html
@@ -76,7 +90,7 @@ Create an **index.html** file in the root directory of your project. Use this fi
7690
<body>
7791
<h4>Azure Communication Services</h4>
7892
<h1>Chat Quickstart</h1>
79-
<script src="./client.js" type="module"></script>
93+
<script src="./bundle.js"></script>
8094
</body>
8195
</html>
8296
```
@@ -110,12 +124,18 @@ console.log('Azure Communication Chat client created!');
110124

111125
### Run the code
112126

127+
Update the `scripts` section in the **package.json** to include "start"
128+
```json
129+
"start": "webpack serve --config ./webpack.config.js"
130+
```
131+
113132
Run the following command to run your application:
114133
```console
115-
npx parcel index.html
134+
npm install
135+
npm run start
116136
```
117137

118-
Open your browser and navigate to http://localhost:1234/. In the developer tools console within your browser, you should see:
138+
Open your browser and navigate to http://localhost:8080/. In the developer tools console within your browser, you should see:
119139

120140
```console
121141
Azure Communication Chat client created!

0 commit comments

Comments
 (0)