widget-chatbot 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +7 -0
- package/CHANGELOG.md +614 -0
- package/CONTRIBUTING.md +44 -0
- package/LICENSE +177 -0
- package/README.md +77 -0
- package/cloudbuild.yaml +29 -0
- package/commitlint.config.js +1 -0
- package/dist/index.js +1 -0
- package/index.js +228 -0
- package/live_chat_helpdesk/HelpdeskChatContextProvider.js +323 -0
- package/live_chat_helpdesk/HelpdeskSender.js +287 -0
- package/live_chat_helpdesk/PayloadContextProvider.js +131 -0
- package/live_chat_helpdesk/constant.js +28 -0
- package/live_chat_helpdesk/useWSChatbot.js +178 -0
- package/npmrc.enc +0 -0
- package/package.json +203 -0
- package/publish_process/README.md +64 -0
- package/test-setup.js +22 -0
- package/umd.js +3 -0
- package/webpack.dev.js +81 -0
- package/webpack.prod.js +100 -0
package/package.json
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "widget-chatbot",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Custom rasa chat widget",
|
|
5
|
+
"module": "module/index.js",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"author": "",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "webpack-dev-server --config webpack.dev.js",
|
|
11
|
+
"build": "webpack --config webpack.prod.js",
|
|
12
|
+
"test": "jest",
|
|
13
|
+
"prepare": "npm run build",
|
|
14
|
+
"release": "standard-version"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"react",
|
|
18
|
+
"chat",
|
|
19
|
+
"widget",
|
|
20
|
+
"javascript"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@ant-design/charts": "^1.1.13",
|
|
24
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
25
|
+
"@popperjs/core": "^2.4.0",
|
|
26
|
+
"@reduxjs/toolkit": "^2.2.7",
|
|
27
|
+
"@stomp/stompjs": "^5.4.2",
|
|
28
|
+
"antd": "^4.20.0",
|
|
29
|
+
"axios": "^1.6.0",
|
|
30
|
+
"babel-plugin-import": "^1.13.8",
|
|
31
|
+
"chart.js": "^4.4.4",
|
|
32
|
+
"crypto-js": "^4.2.0",
|
|
33
|
+
"file-saver": "^2.0.5",
|
|
34
|
+
"immutable": "^3.8.2",
|
|
35
|
+
"object-hash": "^1.1.5",
|
|
36
|
+
"os": "^0.1.2",
|
|
37
|
+
"prop-types": "^15.7.2",
|
|
38
|
+
"react": "^17.0.2",
|
|
39
|
+
"react-chartjs-2": "^5.2.0",
|
|
40
|
+
"react-dom": "^17.0.2",
|
|
41
|
+
"react-draggable": "^4.4.6",
|
|
42
|
+
"react-immutable-proptypes": "^2.2.0",
|
|
43
|
+
"react-markdown": "^8.0.3",
|
|
44
|
+
"react-popper": "^2.2.3",
|
|
45
|
+
"react-redux": "^7.2.5",
|
|
46
|
+
"react-router-dom": "5.2.0",
|
|
47
|
+
"react-textarea-autosize": "^8.5.3",
|
|
48
|
+
"react-use-websocket": "^4.8.1",
|
|
49
|
+
"redux": "^4.0.5",
|
|
50
|
+
"socket.io": "^4.7.5",
|
|
51
|
+
"socket.io-client": "^4.7.5",
|
|
52
|
+
"sockjs-client": "^1.4.0",
|
|
53
|
+
"webhook": "^0.0.2"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@babel/cli": "7.17.6",
|
|
57
|
+
"@babel/core": "7.17.7",
|
|
58
|
+
"@babel/plugin-proposal-object-rest-spread": "7.17.3",
|
|
59
|
+
"@babel/preset-env": "7.16.11",
|
|
60
|
+
"@babel/preset-react": "7.16.7",
|
|
61
|
+
"@commitlint/cli": "^19.2.1",
|
|
62
|
+
"@commitlint/config-conventional": "16.2.1",
|
|
63
|
+
"babel-eslint": "^10.1.0",
|
|
64
|
+
"babel-jest": "27.5.1",
|
|
65
|
+
"babel-loader": "8.2.3",
|
|
66
|
+
"babel-plugin-module-resolver": "^5.0.0",
|
|
67
|
+
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
68
|
+
"babel-preset-stage-0": "^6.24.1",
|
|
69
|
+
"clean-webpack-plugin": "^0.1.19",
|
|
70
|
+
"css-loader": "^6.10.0",
|
|
71
|
+
"eslint": "8.11.0",
|
|
72
|
+
"eslint-config-airbnb": "19.0.4",
|
|
73
|
+
"eslint-config-prettier": "^1.6.0",
|
|
74
|
+
"eslint-import-resolver-babel-module": "^5.1.2",
|
|
75
|
+
"eslint-plugin-flowtype": "^2.50.3",
|
|
76
|
+
"eslint-plugin-import": "^2.18.2",
|
|
77
|
+
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
78
|
+
"eslint-plugin-prettier": "^2.7.0",
|
|
79
|
+
"eslint-plugin-react": "^7.32.2",
|
|
80
|
+
"file-loader": "^6.2.0",
|
|
81
|
+
"html-webpack-plugin": "^5.6.0",
|
|
82
|
+
"husky": "^3.1.0",
|
|
83
|
+
"jest": "^29.7.0",
|
|
84
|
+
"lodash-webpack-plugin": "^0.11.5",
|
|
85
|
+
"prettier": "2.5.1",
|
|
86
|
+
"prettier-eslint": "13.0.0",
|
|
87
|
+
"redux-mock-store": "^1.5.4",
|
|
88
|
+
"standard-version": "^9.3.1",
|
|
89
|
+
"string-replace-loader": "^3.1.0",
|
|
90
|
+
"style-loader": "^3.3.4",
|
|
91
|
+
"terser-webpack-plugin": "^5.3.10",
|
|
92
|
+
"url-loader": "^4.1.1",
|
|
93
|
+
"webpack": "^5.90.3",
|
|
94
|
+
"webpack-bundle-analyzer": "^4.10.2",
|
|
95
|
+
"webpack-cli": "^5.1.4",
|
|
96
|
+
"webpack-dev-server": "^5.0.3"
|
|
97
|
+
},
|
|
98
|
+
"jest": {
|
|
99
|
+
"verbose": true,
|
|
100
|
+
"moduleNameMapper": {
|
|
101
|
+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/mocks/fileMock.js",
|
|
102
|
+
"\\.(css|scss)$": "<rootDir>/mocks/styleMock.js"
|
|
103
|
+
},
|
|
104
|
+
"keywords": [
|
|
105
|
+
"react",
|
|
106
|
+
"chat",
|
|
107
|
+
"widget",
|
|
108
|
+
"javascript"
|
|
109
|
+
],
|
|
110
|
+
"dependencies": {
|
|
111
|
+
"@ant-design/charts": "^1.1.13",
|
|
112
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
113
|
+
"@popperjs/core": "^2.4.0",
|
|
114
|
+
"@reduxjs/toolkit": "^2.2.7",
|
|
115
|
+
"@stomp/stompjs": "^5.4.2",
|
|
116
|
+
"antd": "^4.20.0",
|
|
117
|
+
"axios": "^1.6.0",
|
|
118
|
+
"babel-plugin-import": "^1.13.8",
|
|
119
|
+
"chart.js": "^4.4.4",
|
|
120
|
+
"crypto-js": "^4.2.0",
|
|
121
|
+
"file-saver": "^2.0.5",
|
|
122
|
+
"immutable": "^3.8.2",
|
|
123
|
+
"object-hash": "^1.1.5",
|
|
124
|
+
"os": "^0.1.2",
|
|
125
|
+
"prop-types": "^15.7.2",
|
|
126
|
+
"react": "^17.0.2",
|
|
127
|
+
"react-chartjs-2": "^5.2.0",
|
|
128
|
+
"react-dom": "^17.0.2",
|
|
129
|
+
"react-draggable": "^4.4.6",
|
|
130
|
+
"react-immutable-proptypes": "^2.2.0",
|
|
131
|
+
"react-markdown": "^8.0.3",
|
|
132
|
+
"react-popper": "^2.2.3",
|
|
133
|
+
"react-redux": "^7.2.5",
|
|
134
|
+
"react-router-dom": "5.2.0",
|
|
135
|
+
"react-textarea-autosize": "^8.5.3",
|
|
136
|
+
"react-use-websocket": "^4.8.1",
|
|
137
|
+
"redux": "^4.0.5",
|
|
138
|
+
"socket.io": "^4.7.5",
|
|
139
|
+
"socket.io-client": "^4.7.5",
|
|
140
|
+
"sockjs-client": "^1.4.0",
|
|
141
|
+
"webhook": "^0.0.2"
|
|
142
|
+
},
|
|
143
|
+
"devDependencies": {
|
|
144
|
+
"@babel/cli": "7.17.6",
|
|
145
|
+
"@babel/core": "7.17.7",
|
|
146
|
+
"@babel/plugin-proposal-object-rest-spread": "7.17.3",
|
|
147
|
+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
148
|
+
"@babel/preset-env": "7.16.11",
|
|
149
|
+
"@babel/preset-react": "7.16.7",
|
|
150
|
+
"@commitlint/cli": "^19.2.1",
|
|
151
|
+
"@commitlint/config-conventional": "16.2.1",
|
|
152
|
+
"babel-eslint": "^10.1.0",
|
|
153
|
+
"babel-jest": "27.5.1",
|
|
154
|
+
"babel-loader": "8.2.3",
|
|
155
|
+
"babel-plugin-module-resolver": "^5.0.0",
|
|
156
|
+
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
157
|
+
"babel-preset-stage-0": "^6.24.1",
|
|
158
|
+
"clean-webpack-plugin": "^0.1.19",
|
|
159
|
+
"css-loader": "^6.10.0",
|
|
160
|
+
"eslint": "8.11.0",
|
|
161
|
+
"eslint-config-airbnb": "19.0.4",
|
|
162
|
+
"eslint-config-prettier": "^1.6.0",
|
|
163
|
+
"eslint-import-resolver-babel-module": "^5.1.2",
|
|
164
|
+
"eslint-plugin-flowtype": "^2.50.3",
|
|
165
|
+
"eslint-plugin-import": "^2.18.2",
|
|
166
|
+
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
167
|
+
"eslint-plugin-prettier": "^2.7.0",
|
|
168
|
+
"eslint-plugin-react": "^7.32.2",
|
|
169
|
+
"file-loader": "^6.2.0",
|
|
170
|
+
"html-webpack-plugin": "^5.6.0",
|
|
171
|
+
"husky": "^3.1.0",
|
|
172
|
+
"install": "^0.13.0",
|
|
173
|
+
"jest": "^29.7.0",
|
|
174
|
+
"lodash-webpack-plugin": "^0.11.5",
|
|
175
|
+
"npm": "^11.1.0",
|
|
176
|
+
"prettier": "2.5.1",
|
|
177
|
+
"prettier-eslint": "13.0.0",
|
|
178
|
+
"redux-mock-store": "^1.5.4",
|
|
179
|
+
"standard-version": "^9.3.1",
|
|
180
|
+
"string-replace-loader": "^3.1.0",
|
|
181
|
+
"style-loader": "^3.3.4",
|
|
182
|
+
"terser-webpack-plugin": "^5.3.10",
|
|
183
|
+
"url-loader": "^4.1.1",
|
|
184
|
+
"webpack": "^5.90.3",
|
|
185
|
+
"webpack-bundle-analyzer": "^4.10.2",
|
|
186
|
+
"webpack-cli": "^5.1.4",
|
|
187
|
+
"webpack-dev-server": "^5.0.3"
|
|
188
|
+
},
|
|
189
|
+
"jest": {
|
|
190
|
+
"verbose": true,
|
|
191
|
+
"moduleNameMapper": {
|
|
192
|
+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/mocks/fileMock.js",
|
|
193
|
+
"\\.(css|scss)$": "<rootDir>/mocks/styleMock.js"
|
|
194
|
+
},
|
|
195
|
+
"setupTestFrameworkScriptFile": "<rootDir>/test-setup.js"
|
|
196
|
+
},
|
|
197
|
+
"husky": {
|
|
198
|
+
"hooks": {
|
|
199
|
+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Publish Process
|
|
2
|
+
|
|
3
|
+
## Publish
|
|
4
|
+
|
|
5
|
+
### Development and Testing
|
|
6
|
+
|
|
7
|
+
- Update version
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm version 1.x.x-alpha.x
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- Publish
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm publish --otp=<otpCode> --tag alpha.x
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Production
|
|
20
|
+
|
|
21
|
+
- Update version
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm version 1.x.x
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Publish
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npm publish --otp=<otpCode>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Unpublish
|
|
34
|
+
|
|
35
|
+
If published package less than 72 hours and you want to revert/unpublish the chatbot package, try this command.
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
npm unpublish custom-chatbot-widget@1.x.x
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Some Important Notes
|
|
42
|
+
|
|
43
|
+
### Versi Stabil vs. Prerelease
|
|
44
|
+
|
|
45
|
+
Stable versions (a.b.c) cannot be republished after being unpublished because NPM retains the metadata of stable versions permanently.
|
|
46
|
+
|
|
47
|
+
For prerelease versions (a.b.c-alpha.x), the metadata is not stored permanently after unpublishing, so you can republish the same version.
|
|
48
|
+
|
|
49
|
+
You must first unpublish the version a.b.c-alpha.x.
|
|
50
|
+
As long as the version no longer exists in the registry, you can republish it with the same version number.
|
|
51
|
+
|
|
52
|
+
### Check published version
|
|
53
|
+
|
|
54
|
+
To check all versions that may not be displayed in the NPM registry
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
npm info custom-chatbot-widget --json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
To check all versions that are already displayed in the NPM registry
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
npm view custom-chatbot-widget versions
|
|
64
|
+
```
|
package/test-setup.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// /* eslint-disable func-names */
|
|
2
|
+
// import Enzyme from 'enzyme';
|
|
3
|
+
// import Adapter from 'enzyme-adapter-react-16';
|
|
4
|
+
|
|
5
|
+
// Enzyme.configure({ adapter: new Adapter() });
|
|
6
|
+
// window.matchMedia =
|
|
7
|
+
// window.matchMedia ||
|
|
8
|
+
// function () {
|
|
9
|
+
// return {
|
|
10
|
+
// matches: false,
|
|
11
|
+
// addListener() {},
|
|
12
|
+
// removeListener() {}
|
|
13
|
+
// };
|
|
14
|
+
// };
|
|
15
|
+
|
|
16
|
+
// window.requestAnimationFrame =
|
|
17
|
+
// window.requestAnimationFrame ||
|
|
18
|
+
// function (callback) {
|
|
19
|
+
// setTimeout(callback, 0);
|
|
20
|
+
// };
|
|
21
|
+
|
|
22
|
+
// Enzyme.configure({ adapter: new Adapter() });
|
package/umd.js
ADDED
package/webpack.dev.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
3
|
+
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
4
|
+
const TerserPlugin = require('terser-webpack-plugin');
|
|
5
|
+
const { version } = require('./package.json');
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
// entry: ['babel-polyfill', './index.js'],
|
|
9
|
+
entry: './umd.js',
|
|
10
|
+
output: {
|
|
11
|
+
path: path.join(__dirname, '/dist'),
|
|
12
|
+
filename: 'index.js',
|
|
13
|
+
library: 'WebChat',
|
|
14
|
+
libraryTarget: 'umd',
|
|
15
|
+
},
|
|
16
|
+
devServer: {
|
|
17
|
+
host: '127.0.0.1',
|
|
18
|
+
allowedHosts: 'all',
|
|
19
|
+
headers: {
|
|
20
|
+
'Access-Control-Allow-Origin': '*',
|
|
21
|
+
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
|
22
|
+
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
|
|
23
|
+
},
|
|
24
|
+
port: 8082,
|
|
25
|
+
historyApiFallback: { disableDotRule: true },
|
|
26
|
+
hot: false,
|
|
27
|
+
client: { overlay: false },
|
|
28
|
+
liveReload: false,
|
|
29
|
+
},
|
|
30
|
+
resolve: {
|
|
31
|
+
extensions: ['.js', '.jsx'],
|
|
32
|
+
},
|
|
33
|
+
mode: 'development',
|
|
34
|
+
devtool: 'eval-source-map',
|
|
35
|
+
module: {
|
|
36
|
+
rules: [
|
|
37
|
+
{
|
|
38
|
+
test: /\.(js|jsx)$/,
|
|
39
|
+
exclude: /node_modules/,
|
|
40
|
+
use: [
|
|
41
|
+
{
|
|
42
|
+
loader: 'string-replace-loader',
|
|
43
|
+
options: {
|
|
44
|
+
search: 'PACKAGE_VERSION_TO_BE_REPLACED',
|
|
45
|
+
replace: version,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{ loader: 'babel-loader' },
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
test: /\.scss$/,
|
|
53
|
+
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
test: /\.css$/,
|
|
57
|
+
use: ['style-loader', 'css-loader'],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
test: /\.(jpg|png|gif|svg|woff|ttf|eot)$/,
|
|
61
|
+
use: {
|
|
62
|
+
loader: 'url-loader',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
plugins: [
|
|
68
|
+
new HtmlWebpackPlugin({
|
|
69
|
+
title: 'Web Chat Widget Test',
|
|
70
|
+
filename: 'index.html',
|
|
71
|
+
inject: false,
|
|
72
|
+
template: 'dev/src/index.html',
|
|
73
|
+
showErrors: true,
|
|
74
|
+
}),
|
|
75
|
+
// new BundleAnalyzerPlugin()
|
|
76
|
+
],
|
|
77
|
+
optimization: {
|
|
78
|
+
minimize: true,
|
|
79
|
+
minimizer: [new TerserPlugin()],
|
|
80
|
+
},
|
|
81
|
+
};
|
package/webpack.prod.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
+
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
|
4
|
+
const { version } = require('./package.json');
|
|
5
|
+
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
6
|
+
const TerserPlugin = require('terser-webpack-plugin');
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
// entry: ['babel-polyfill', './index.js'],
|
|
10
|
+
// entry: './umd.js',
|
|
11
|
+
entry: './index.js',
|
|
12
|
+
// entry: path.resolve(__dirname, 'src/umd.js'),
|
|
13
|
+
output: {
|
|
14
|
+
path: path.join(__dirname, '/dist'),
|
|
15
|
+
filename: 'index.js',
|
|
16
|
+
library: 'WebChat',
|
|
17
|
+
libraryTarget: 'umd',
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
externals: {
|
|
21
|
+
react: 'react',
|
|
22
|
+
'react-dom': 'react-dom',
|
|
23
|
+
axios: 'axios',
|
|
24
|
+
redux: 'redux',
|
|
25
|
+
'react-redux': 'react-redux',
|
|
26
|
+
'socket.io-client': 'socket.io-client',
|
|
27
|
+
'react-markdown': 'react-markdown',
|
|
28
|
+
antd: 'antd',
|
|
29
|
+
'@antv/g2': '@antv/g2',
|
|
30
|
+
'@antv/g6': '@antv/g6',
|
|
31
|
+
'@antv/g2plot': '@antv/g2plot',
|
|
32
|
+
'@antv/l7': '@antv/l7',
|
|
33
|
+
'chart.js': 'chart.js',
|
|
34
|
+
'crypto-js': 'crypto-js',
|
|
35
|
+
'@reduxjs/toolkit': '@reduxjs/toolkit',
|
|
36
|
+
},
|
|
37
|
+
resolve: {
|
|
38
|
+
extensions: ['.js', '.jsx'],
|
|
39
|
+
},
|
|
40
|
+
mode: 'production',
|
|
41
|
+
module: {
|
|
42
|
+
rules: [
|
|
43
|
+
{
|
|
44
|
+
test: /\.(js|jsx)$/,
|
|
45
|
+
exclude: /node_modules/,
|
|
46
|
+
use: [
|
|
47
|
+
{
|
|
48
|
+
loader: 'string-replace-loader',
|
|
49
|
+
options: {
|
|
50
|
+
search: 'PACKAGE_VERSION_TO_BE_REPLACED',
|
|
51
|
+
replace: version,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{ loader: 'babel-loader' },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
test: /\.scss$/,
|
|
59
|
+
use: [
|
|
60
|
+
{ loader: 'style-loader' },
|
|
61
|
+
{ loader: 'css-loader' },
|
|
62
|
+
// {
|
|
63
|
+
// loader: 'sass-loader',
|
|
64
|
+
// options: {
|
|
65
|
+
// sassOptions: {
|
|
66
|
+
// includePaths: [path.resolve(__dirname, 'src/scss/')]
|
|
67
|
+
// }
|
|
68
|
+
// }
|
|
69
|
+
// }
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
test: /\.css$/,
|
|
74
|
+
use: ['style-loader', 'css-loader'],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
test: /\.(jpg|png|gif|svg|woff|ttf|eot)$/,
|
|
78
|
+
use: {
|
|
79
|
+
loader: 'url-loader',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
plugins: [
|
|
85
|
+
new CleanWebpackPlugin(['dist']),
|
|
86
|
+
// new BundleAnalyzerPlugin()
|
|
87
|
+
],
|
|
88
|
+
optimization: {
|
|
89
|
+
minimize: true,
|
|
90
|
+
minimizer: [
|
|
91
|
+
new TerserPlugin({
|
|
92
|
+
extractComments: false,
|
|
93
|
+
terserOptions: {
|
|
94
|
+
compress: { drop_console: true },
|
|
95
|
+
output: { comments: false },
|
|
96
|
+
},
|
|
97
|
+
}),
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
};
|