Skip to content

Commit c601a99

Browse files
authored
Merge pull request #127478 from JoshuaLai/patch-8
Update the steps to use webpack
2 parents bf1f2fe + 0e8a292 commit c601a99

File tree

1 file changed

+27
-7
lines changed
  • articles/communication-services/quickstarts/chat/includes

1 file changed

+27
-7
lines changed

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

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
title: include file
33
description: include file
44
services: azure-communication-services
5-
author: probableprime
5+
author: awang119
66
manager: mikben
77
ms.service: azure-communication-services
88
ms.subservice: azure-communication-services
99
ms.date: 06/30/2021
1010
ms.topic: include
1111
ms.custom: include file
12-
ms.author: rifox
12+
ms.author: anniewang
1313
---
1414

1515
## Prerequisites
@@ -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)