@twilio/flex-plugin-webpack 5.0.1-beta.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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/compiler.d.ts +34 -0
- package/dist/compiler.js +223 -0
- package/dist/compiler.js.map +1 -0
- package/dist/devServer/ipcServer.d.ts +83 -0
- package/dist/devServer/ipcServer.js +227 -0
- package/dist/devServer/ipcServer.js.map +1 -0
- package/dist/devServer/pluginServer.d.ts +78 -0
- package/dist/devServer/pluginServer.js +273 -0
- package/dist/devServer/pluginServer.js.map +1 -0
- package/dist/devServer/webpackDevServer.d.ts +11 -0
- package/dist/devServer/webpackDevServer.js +108 -0
- package/dist/devServer/webpackDevServer.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/DelayRenderStaticPlugin.d.ts +4 -0
- package/dist/plugins/DelayRenderStaticPlugin.js +63 -0
- package/dist/plugins/DelayRenderStaticPlugin.js.map +1 -0
- package/dist/prints/devServerSuccessful.d.ts +12 -0
- package/dist/prints/devServerSuccessful.js +48 -0
- package/dist/prints/devServerSuccessful.js.map +1 -0
- package/dist/prints/dotEnvIncorrectVariable.d.ts +2 -0
- package/dist/prints/dotEnvIncorrectVariable.js +11 -0
- package/dist/prints/dotEnvIncorrectVariable.js.map +1 -0
- package/dist/prints/index.d.ts +3 -0
- package/dist/prints/index.js +13 -0
- package/dist/prints/index.js.map +1 -0
- package/dist/prints/remotePluginNotFound.d.ts +9 -0
- package/dist/prints/remotePluginNotFound.js +57 -0
- package/dist/prints/remotePluginNotFound.js.map +1 -0
- package/dist/webpack/clientVariables.d.ts +26 -0
- package/dist/webpack/clientVariables.js +78 -0
- package/dist/webpack/clientVariables.js.map +1 -0
- package/dist/webpack/pnpTs.d.ts +10 -0
- package/dist/webpack/pnpTs.js +13 -0
- package/dist/webpack/pnpTs.js.map +1 -0
- package/dist/webpack/webpack.config.d.ts +78 -0
- package/dist/webpack/webpack.config.js +506 -0
- package/dist/webpack/webpack.config.js.map +1 -0
- package/dist/webpack/webpack.dev.d.ts +22 -0
- package/dist/webpack/webpack.dev.js +75 -0
- package/dist/webpack/webpack.dev.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
|
|
3
|
+
/// <reference path="../module.d.ts" />
|
|
4
|
+
var __assign = (this && this.__assign) || function () {
|
|
5
|
+
__assign = Object.assign || function(t) {
|
|
6
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7
|
+
s = arguments[i];
|
|
8
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
9
|
+
t[p] = s[p];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
return __assign.apply(this, arguments);
|
|
14
|
+
};
|
|
15
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
16
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
17
|
+
if (!m) return o;
|
|
18
|
+
var i = m.call(o), r, ar = [], e;
|
|
19
|
+
try {
|
|
20
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
21
|
+
}
|
|
22
|
+
catch (error) { e = { error: error }; }
|
|
23
|
+
finally {
|
|
24
|
+
try {
|
|
25
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
26
|
+
}
|
|
27
|
+
finally { if (e) throw e.error; }
|
|
28
|
+
}
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
32
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
33
|
+
to[j] = from[i];
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports._getJavaScriptConfiguration = exports._getStaticConfiguration = exports._getBase = exports._getResolve = exports._getOptimization = exports._getJavaScriptEntries = exports._getJSPlugins = exports._getStaticPlugins = exports._getBasePlugins = exports._getStyleLoaders = exports._getImageLoader = exports._getJSScripts = void 0;
|
|
41
|
+
var interpolate_html_plugin_1 = __importDefault(require("@k88/interpolate-html-plugin"));
|
|
42
|
+
var module_scope_plugin_1 = __importDefault(require("@k88/module-scope-plugin"));
|
|
43
|
+
var typescript_compile_error_formatter_1 = __importDefault(require("@k88/typescript-compile-error-formatter"));
|
|
44
|
+
var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
|
|
45
|
+
var env_1 = require("@twilio/flex-dev-utils/dist/env");
|
|
46
|
+
var fs_1 = require("@twilio/flex-dev-utils/dist/fs");
|
|
47
|
+
var fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
48
|
+
var html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
49
|
+
var pnp_webpack_plugin_1 = __importDefault(require("pnp-webpack-plugin"));
|
|
50
|
+
var terser_webpack_plugin_1 = __importDefault(require("terser-webpack-plugin"));
|
|
51
|
+
var webpack_1 = require("webpack");
|
|
52
|
+
var clientVariables_1 = require("./clientVariables");
|
|
53
|
+
var __1 = require("..");
|
|
54
|
+
var IMAGE_SIZE_BYTE = 10 * 1024;
|
|
55
|
+
var FLEX_SHIM = '@twilio/flex-plugin-scripts/dev_assets/flex-shim.js';
|
|
56
|
+
var EXTERNALS = {
|
|
57
|
+
react: 'React',
|
|
58
|
+
'react-dom': 'ReactDOM',
|
|
59
|
+
redux: 'Redux',
|
|
60
|
+
'react-redux': 'ReactRedux',
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Returns the JS scripts to inject into the index.html file
|
|
64
|
+
* @param flexUIVersion the flex-ui version
|
|
65
|
+
* @param reactVersion the react version
|
|
66
|
+
* @param reactDOMVersion the react-dom version
|
|
67
|
+
*/
|
|
68
|
+
var _getJSScripts = function (flexUIVersion, reactVersion, reactDOMVersion) {
|
|
69
|
+
var envSrc = flex_dev_utils_1.env.getFlexUISrc();
|
|
70
|
+
if (!flex_dev_utils_1.semver.satisfies(flexUIVersion, '>=1.19.0')) {
|
|
71
|
+
if (envSrc) {
|
|
72
|
+
return ["<script src=\"" + envSrc + "\"></script>"];
|
|
73
|
+
}
|
|
74
|
+
return [
|
|
75
|
+
"<script src=\"https://assets.flex.twilio.com/releases/flex-ui/" + flexUIVersion + "/twilio-flex.min.js\"></script>",
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
var flexUISrc = envSrc || "https://assets.flex.twilio.com/releases/flex-ui/" + flexUIVersion + "/twilio-flex.unbundled-react.min.js";
|
|
79
|
+
return [
|
|
80
|
+
"<script crossorigin src=\"https://unpkg.com/react@" + reactVersion + "/umd/react.development.js\"></script>",
|
|
81
|
+
"<script crossorigin src=\"https://unpkg.com/react-dom@" + reactDOMVersion + "/umd/react-dom.development.js\"></script>",
|
|
82
|
+
"<script src=\"" + flexUISrc + "\"></script>",
|
|
83
|
+
];
|
|
84
|
+
};
|
|
85
|
+
exports._getJSScripts = _getJSScripts;
|
|
86
|
+
/**
|
|
87
|
+
* Returns the Babel Loader configuration
|
|
88
|
+
* @param isProd whether this is a production build
|
|
89
|
+
*/
|
|
90
|
+
/* istanbul ignore next */
|
|
91
|
+
var _getBabelLoader = function (isProd) { return ({
|
|
92
|
+
test: new RegExp(".(" + fs_1.getPaths().extensions.join('|') + ")$"),
|
|
93
|
+
include: fs_1.getPaths().app.srcDir,
|
|
94
|
+
loader: require.resolve('babel-loader'),
|
|
95
|
+
options: {
|
|
96
|
+
customize: require.resolve('babel-preset-react-app/webpack-overrides'),
|
|
97
|
+
babelrc: false,
|
|
98
|
+
configFile: false,
|
|
99
|
+
presets: [require.resolve('babel-preset-react-app')],
|
|
100
|
+
plugins: [
|
|
101
|
+
[
|
|
102
|
+
require.resolve('babel-plugin-named-asset-import'),
|
|
103
|
+
{
|
|
104
|
+
loaderMap: {
|
|
105
|
+
svg: { ReactComponent: '@svgr/webpack?-svgo,+titleProp,+ref![path]' },
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
],
|
|
110
|
+
compact: isProd,
|
|
111
|
+
},
|
|
112
|
+
}); };
|
|
113
|
+
/**
|
|
114
|
+
* Gets the image loader
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
117
|
+
/* istanbul ignore next */
|
|
118
|
+
var _getImageLoader = function () { return ({
|
|
119
|
+
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
|
|
120
|
+
loader: require.resolve('url-loader'),
|
|
121
|
+
options: {
|
|
122
|
+
limit: IMAGE_SIZE_BYTE,
|
|
123
|
+
},
|
|
124
|
+
}); };
|
|
125
|
+
exports._getImageLoader = _getImageLoader;
|
|
126
|
+
/**
|
|
127
|
+
* Gets the styles loader
|
|
128
|
+
* @param isProd whether this is a production build
|
|
129
|
+
* @private
|
|
130
|
+
*/
|
|
131
|
+
var _getStyleLoaders = function (isProd) {
|
|
132
|
+
/**
|
|
133
|
+
* Gets the loader for the given style
|
|
134
|
+
* @param options the options
|
|
135
|
+
* @param preProcessor the pre-processor, for example scss-loader
|
|
136
|
+
* @param implementation the implementation for thr scss-loader
|
|
137
|
+
*/
|
|
138
|
+
var getStyleLoader = function (options, preProcessor, implementation) {
|
|
139
|
+
var loaders = [];
|
|
140
|
+
// Main style loader to work when compiled
|
|
141
|
+
loaders.push(require.resolve('style-loader'));
|
|
142
|
+
// All css loader
|
|
143
|
+
loaders.push({
|
|
144
|
+
loader: require.resolve('css-loader'),
|
|
145
|
+
options: options,
|
|
146
|
+
}, {
|
|
147
|
+
loader: require.resolve('postcss-loader'),
|
|
148
|
+
options: {
|
|
149
|
+
postcssOptions: {
|
|
150
|
+
plugins: function () { return [
|
|
151
|
+
require('postcss-flexbugs-fixes'),
|
|
152
|
+
require('postcss-preset-env')({
|
|
153
|
+
autoprefixer: {
|
|
154
|
+
flexbox: 'no-2009',
|
|
155
|
+
},
|
|
156
|
+
stage: 3,
|
|
157
|
+
}),
|
|
158
|
+
]; },
|
|
159
|
+
},
|
|
160
|
+
sourceMap: isProd,
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
// Add a pre-processor loader (converting SCSS to CSS)
|
|
164
|
+
if (preProcessor) {
|
|
165
|
+
var preProcessorOptions = {
|
|
166
|
+
sourceMap: isProd,
|
|
167
|
+
};
|
|
168
|
+
if (implementation) {
|
|
169
|
+
var nodePath = fs_1.resolveModulePath(implementation);
|
|
170
|
+
if (nodePath) {
|
|
171
|
+
preProcessorOptions.implementation = require(nodePath);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
loaders.push({
|
|
175
|
+
loader: require.resolve('resolve-url-loader'),
|
|
176
|
+
options: {
|
|
177
|
+
sourceMap: isProd,
|
|
178
|
+
},
|
|
179
|
+
}, {
|
|
180
|
+
loader: require.resolve(preProcessor),
|
|
181
|
+
options: preProcessorOptions,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
return loaders;
|
|
185
|
+
};
|
|
186
|
+
return [
|
|
187
|
+
{
|
|
188
|
+
test: /\.css$/,
|
|
189
|
+
exclude: /\.module\.css$/,
|
|
190
|
+
use: getStyleLoader({
|
|
191
|
+
importLoaders: 1,
|
|
192
|
+
sourceMap: isProd,
|
|
193
|
+
}),
|
|
194
|
+
sideEffects: true,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
test: /\.module\.css$/,
|
|
198
|
+
use: getStyleLoader({
|
|
199
|
+
importLoaders: 1,
|
|
200
|
+
sourceMap: isProd,
|
|
201
|
+
modules: true,
|
|
202
|
+
}),
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
test: /\.(scss|sass)$/,
|
|
206
|
+
exclude: /\.module\.(scss|sass)$/,
|
|
207
|
+
use: getStyleLoader({
|
|
208
|
+
importLoaders: 3,
|
|
209
|
+
sourceMap: isProd,
|
|
210
|
+
}, 'sass-loader', 'node-sass'),
|
|
211
|
+
sideEffects: true,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
test: /\.module\.(scss|sass)$/,
|
|
215
|
+
use: getStyleLoader({
|
|
216
|
+
importLoaders: 3,
|
|
217
|
+
sourceMap: isProd,
|
|
218
|
+
modules: true,
|
|
219
|
+
}, 'sass-loader', 'node-sass'),
|
|
220
|
+
},
|
|
221
|
+
];
|
|
222
|
+
};
|
|
223
|
+
exports._getStyleLoaders = _getStyleLoaders;
|
|
224
|
+
/**
|
|
225
|
+
* Returns an array of {@link Plugin} for Webpack
|
|
226
|
+
* @param environment the environment
|
|
227
|
+
* @private
|
|
228
|
+
*/
|
|
229
|
+
var _getBasePlugins = function (environment) {
|
|
230
|
+
var plugins = [];
|
|
231
|
+
var flexUIVersion = fs_1.getDependencyVersion('@twilio/flex-ui');
|
|
232
|
+
var reactVersion = fs_1.getDependencyVersion('react');
|
|
233
|
+
var reactDOMVersion = fs_1.getDependencyVersion('react-dom');
|
|
234
|
+
var defined = {
|
|
235
|
+
__FPB_PLUGIN_UNIQUE_NAME: "'" + fs_1.getPaths().app.name + "'",
|
|
236
|
+
__FPB_PLUGIN_VERSION: "'" + fs_1.getPaths().app.version + "'",
|
|
237
|
+
__FPB_FLEX_PLUGIN_SCRIPTS_VERSION: "'" + fs_1.getDependencyVersion('@twilio/flex-plugin-scripts') + "'",
|
|
238
|
+
__FPB_FLEX_PLUGIN_VERSION: "'" + fs_1.getDependencyVersion('@twilio/flex-plugin') + "'",
|
|
239
|
+
__FPB_FLEX_UI_VERSION: "'" + flexUIVersion + "'",
|
|
240
|
+
__FPB_REACT_VERSION: "'" + reactVersion + "'",
|
|
241
|
+
__FPB_REACT_DOM_VERSION: "'" + reactDOMVersion + "'",
|
|
242
|
+
// backward compatibility with v3
|
|
243
|
+
__FPB_CRACO_CONFIG_FLEX_PLUGIN_VERSION: "'N/A'",
|
|
244
|
+
};
|
|
245
|
+
// The @k88/cra-webpack-hot-dev-client package requires these environment variables to be replaced
|
|
246
|
+
if (environment === env_1.Environment.Development) {
|
|
247
|
+
if (flex_dev_utils_1.env.getWDSSocketHost()) {
|
|
248
|
+
defined['process.env.WDS_SOCKET_HOST'] = flex_dev_utils_1.env.getWDSSocketHost();
|
|
249
|
+
}
|
|
250
|
+
if (flex_dev_utils_1.env.getWDSSocketPath()) {
|
|
251
|
+
defined['process.env.WDS_SOCKET_PATH'] = flex_dev_utils_1.env.getWDSSocketPath();
|
|
252
|
+
}
|
|
253
|
+
if (flex_dev_utils_1.env.getWDSSocketPort()) {
|
|
254
|
+
defined['process.env.WDS_SOCKET_PORT'] = flex_dev_utils_1.env.getWDSSocketPort();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
plugins.push(new webpack_1.DefinePlugin(__assign(__assign({}, defined), clientVariables_1.getSanitizedProcessEnv())));
|
|
258
|
+
return plugins;
|
|
259
|
+
};
|
|
260
|
+
exports._getBasePlugins = _getBasePlugins;
|
|
261
|
+
/**
|
|
262
|
+
* Returns an array of {@link Plugin} for Webpack Static
|
|
263
|
+
* @param environment
|
|
264
|
+
*/
|
|
265
|
+
var _getStaticPlugins = function (environment) {
|
|
266
|
+
var plugins = [];
|
|
267
|
+
var dependencies = fs_1.getPaths().app.dependencies;
|
|
268
|
+
// index.html entry point
|
|
269
|
+
if (environment === env_1.Environment.Development) {
|
|
270
|
+
plugins.push(new webpack_1.HotModuleReplacementPlugin());
|
|
271
|
+
plugins.push(new html_webpack_plugin_1.default({
|
|
272
|
+
inject: false,
|
|
273
|
+
hash: false,
|
|
274
|
+
template: fs_1.getPaths().scripts.indexHTMLPath,
|
|
275
|
+
}));
|
|
276
|
+
plugins.push(new interpolate_html_plugin_1.default({
|
|
277
|
+
__FPB_JS_SCRIPTS: exports._getJSScripts(dependencies.flexUI.version, dependencies.react.version, dependencies.reactDom.version).join('\n'),
|
|
278
|
+
}));
|
|
279
|
+
}
|
|
280
|
+
return plugins;
|
|
281
|
+
};
|
|
282
|
+
exports._getStaticPlugins = _getStaticPlugins;
|
|
283
|
+
/**
|
|
284
|
+
* Returns an array of {@link Plugin} for Webpack Javascript
|
|
285
|
+
* @param environment
|
|
286
|
+
*/
|
|
287
|
+
var _getJSPlugins = function (environment) {
|
|
288
|
+
var plugins = [];
|
|
289
|
+
var isDev = environment === env_1.Environment.Development;
|
|
290
|
+
var isProd = environment === env_1.Environment.Production;
|
|
291
|
+
if (isProd) {
|
|
292
|
+
plugins.push(new webpack_1.SourceMapDevToolPlugin({
|
|
293
|
+
append: '\n//# sourceMappingURL=bundle.js.map',
|
|
294
|
+
}));
|
|
295
|
+
}
|
|
296
|
+
var hasPnp = 'pnp' in process.versions;
|
|
297
|
+
if (fs_1.getPaths().app.isTSProject()) {
|
|
298
|
+
var typescriptPath = fs_1.resolveModulePath('typescript');
|
|
299
|
+
var config = {
|
|
300
|
+
typescript: typescriptPath || undefined,
|
|
301
|
+
async: isDev,
|
|
302
|
+
useTypescriptIncrementalApi: true,
|
|
303
|
+
checkSyntacticErrors: true,
|
|
304
|
+
resolveModuleNameModule: hasPnp ? __dirname + "/webpack/pnpTs.js" : undefined,
|
|
305
|
+
resolveTypeReferenceDirectiveModule: hasPnp ? __dirname + "/webpack/pnpTs.js" : undefined,
|
|
306
|
+
tsconfig: fs_1.getPaths().app.tsConfigPath,
|
|
307
|
+
reportFiles: [
|
|
308
|
+
'**',
|
|
309
|
+
'!**/__tests__/**',
|
|
310
|
+
'!**/__mocks__/**',
|
|
311
|
+
'!**/?(*.)(spec|test).*',
|
|
312
|
+
'!**/src/setupProxy.*',
|
|
313
|
+
'!**/src/setupTests.*',
|
|
314
|
+
],
|
|
315
|
+
silent: true,
|
|
316
|
+
};
|
|
317
|
+
if (isProd) {
|
|
318
|
+
config.formatter = typescript_compile_error_formatter_1.default;
|
|
319
|
+
}
|
|
320
|
+
plugins.push(new fork_ts_checker_webpack_plugin_1.default(config));
|
|
321
|
+
}
|
|
322
|
+
return plugins;
|
|
323
|
+
};
|
|
324
|
+
exports._getJSPlugins = _getJSPlugins;
|
|
325
|
+
/**
|
|
326
|
+
* Returns the `entry` key of the webpack
|
|
327
|
+
* @private
|
|
328
|
+
*/
|
|
329
|
+
var _getJavaScriptEntries = function () {
|
|
330
|
+
var entry = [];
|
|
331
|
+
entry.push(fs_1.getPaths().app.entryPath);
|
|
332
|
+
return entry;
|
|
333
|
+
};
|
|
334
|
+
exports._getJavaScriptEntries = _getJavaScriptEntries;
|
|
335
|
+
/**
|
|
336
|
+
* Returns the `optimization` key of webpack
|
|
337
|
+
* @param environment the environment
|
|
338
|
+
* @private
|
|
339
|
+
*/
|
|
340
|
+
/* istanbul ignore next */
|
|
341
|
+
var _getOptimization = function (environment) {
|
|
342
|
+
var isProd = environment === env_1.Environment.Production;
|
|
343
|
+
return {
|
|
344
|
+
splitChunks: false,
|
|
345
|
+
runtimeChunk: false,
|
|
346
|
+
minimize: isProd,
|
|
347
|
+
minimizer: [
|
|
348
|
+
new terser_webpack_plugin_1.default({
|
|
349
|
+
terserOptions: {
|
|
350
|
+
parse: {
|
|
351
|
+
ecma: 8,
|
|
352
|
+
},
|
|
353
|
+
compress: {
|
|
354
|
+
ecma: 5,
|
|
355
|
+
warnings: false,
|
|
356
|
+
comparisons: false,
|
|
357
|
+
inline: 2,
|
|
358
|
+
},
|
|
359
|
+
mangle: {
|
|
360
|
+
safari10: true,
|
|
361
|
+
},
|
|
362
|
+
// eslint-disable-next-line camelcase
|
|
363
|
+
keep_classnames: isProd,
|
|
364
|
+
// eslint-disable-next-line camelcase
|
|
365
|
+
keep_fnames: isProd,
|
|
366
|
+
output: {
|
|
367
|
+
ecma: 5,
|
|
368
|
+
comments: false,
|
|
369
|
+
// eslint-disable-next-line camelcase
|
|
370
|
+
ascii_only: true,
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
sourceMap: true,
|
|
374
|
+
}),
|
|
375
|
+
],
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
exports._getOptimization = _getOptimization;
|
|
379
|
+
/**
|
|
380
|
+
* Returns the `resolve` key of webpack
|
|
381
|
+
* @param environment the environment
|
|
382
|
+
* @private
|
|
383
|
+
*/
|
|
384
|
+
var _getResolve = function (environment) {
|
|
385
|
+
var isProd = environment === env_1.Environment.Production;
|
|
386
|
+
var extensions = fs_1.getPaths().app.isTSProject()
|
|
387
|
+
? fs_1.getPaths().extensions
|
|
388
|
+
: fs_1.getPaths().extensions.filter(function (e) { return !e.includes('ts'); });
|
|
389
|
+
var paths = fs_1.getPaths();
|
|
390
|
+
var resolve = {
|
|
391
|
+
modules: [
|
|
392
|
+
'node_modules',
|
|
393
|
+
paths.app.nodeModulesDir,
|
|
394
|
+
paths.scripts.nodeModulesDir,
|
|
395
|
+
paths.webpack.nodeModulesDir,
|
|
396
|
+
paths.cli.nodeModulesDir,
|
|
397
|
+
],
|
|
398
|
+
extensions: extensions.map(function (e) { return "." + e; }),
|
|
399
|
+
alias: {
|
|
400
|
+
'@twilio/flex-ui': FLEX_SHIM,
|
|
401
|
+
},
|
|
402
|
+
plugins: [pnp_webpack_plugin_1.default, new module_scope_plugin_1.default(paths.app.srcDir, [paths.app.pkgPath])],
|
|
403
|
+
};
|
|
404
|
+
if (isProd && resolve.alias) {
|
|
405
|
+
resolve.alias['scheduler/tracing'] = 'scheduler/tracing-profiling';
|
|
406
|
+
}
|
|
407
|
+
return resolve;
|
|
408
|
+
};
|
|
409
|
+
exports._getResolve = _getResolve;
|
|
410
|
+
/**
|
|
411
|
+
* Returns the base {@link Configuration}
|
|
412
|
+
* @private
|
|
413
|
+
*/
|
|
414
|
+
var _getBase = function (environment) {
|
|
415
|
+
var isProd = environment === env_1.Environment.Production;
|
|
416
|
+
var config = {
|
|
417
|
+
resolve: exports._getResolve(environment),
|
|
418
|
+
resolveLoader: {
|
|
419
|
+
plugins: [pnp_webpack_plugin_1.default.moduleLoader(module)],
|
|
420
|
+
},
|
|
421
|
+
externals: EXTERNALS,
|
|
422
|
+
module: {
|
|
423
|
+
strictExportPresence: true,
|
|
424
|
+
rules: [
|
|
425
|
+
{ parser: { requireEnsure: false } },
|
|
426
|
+
{
|
|
427
|
+
oneOf: __spreadArray([exports._getImageLoader(), _getBabelLoader(isProd)], __read(exports._getStyleLoaders(isProd))),
|
|
428
|
+
},
|
|
429
|
+
],
|
|
430
|
+
},
|
|
431
|
+
plugins: exports._getBasePlugins(environment),
|
|
432
|
+
};
|
|
433
|
+
config.mode = isProd ? env_1.Environment.Production : env_1.Environment.Development;
|
|
434
|
+
config.entry = [];
|
|
435
|
+
if (environment === env_1.Environment.Development) {
|
|
436
|
+
config.entry.push(require.resolve('@k88/cra-webpack-hot-dev-client/build'));
|
|
437
|
+
}
|
|
438
|
+
return config;
|
|
439
|
+
};
|
|
440
|
+
exports._getBase = _getBase;
|
|
441
|
+
/**
|
|
442
|
+
* Returns the {@link Configuration} for static type
|
|
443
|
+
* @private
|
|
444
|
+
*/
|
|
445
|
+
var _getStaticConfiguration = function (config, environment) {
|
|
446
|
+
var _a;
|
|
447
|
+
config.plugins = config.plugins ? config.plugins : [];
|
|
448
|
+
(_a = config.plugins).push.apply(_a, __spreadArray([], __read(exports._getStaticPlugins(environment))));
|
|
449
|
+
return config;
|
|
450
|
+
};
|
|
451
|
+
exports._getStaticConfiguration = _getStaticConfiguration;
|
|
452
|
+
/**
|
|
453
|
+
* Returns the {@link Configuration} for JS type
|
|
454
|
+
* @private
|
|
455
|
+
*/
|
|
456
|
+
var _getJavaScriptConfiguration = function (config, environment) {
|
|
457
|
+
var _a, _b;
|
|
458
|
+
var isProd = environment === env_1.Environment.Production;
|
|
459
|
+
var filename = fs_1.getPaths().app.name + ".js";
|
|
460
|
+
var outputName = environment === env_1.Environment.Production ? filename : "plugins/" + filename;
|
|
461
|
+
config.entry = config.entry ? config.entry : [];
|
|
462
|
+
config.plugins = config.plugins ? config.plugins : [];
|
|
463
|
+
// @ts-ignore
|
|
464
|
+
(_a = config.entry).push.apply(_a, __spreadArray([], __read(exports._getJavaScriptEntries())));
|
|
465
|
+
config.output = {
|
|
466
|
+
path: fs_1.getPaths().app.buildDir,
|
|
467
|
+
pathinfo: !isProd,
|
|
468
|
+
futureEmitAssets: true,
|
|
469
|
+
filename: outputName,
|
|
470
|
+
publicPath: fs_1.getPaths().app.publicDir,
|
|
471
|
+
globalObject: 'this',
|
|
472
|
+
};
|
|
473
|
+
config.bail = isProd;
|
|
474
|
+
config.devtool = isProd ? 'hidden-source-map' : 'source-map';
|
|
475
|
+
config.optimization = exports._getOptimization(environment);
|
|
476
|
+
config.node = {
|
|
477
|
+
module: 'empty',
|
|
478
|
+
dgram: 'empty',
|
|
479
|
+
dns: 'mock',
|
|
480
|
+
fs: 'empty',
|
|
481
|
+
http2: 'empty',
|
|
482
|
+
net: 'empty',
|
|
483
|
+
tls: 'empty',
|
|
484
|
+
// eslint-disable-next-line camelcase
|
|
485
|
+
child_process: 'empty',
|
|
486
|
+
};
|
|
487
|
+
(_b = config.plugins).push.apply(_b, __spreadArray([], __read(exports._getJSPlugins(environment))));
|
|
488
|
+
return config;
|
|
489
|
+
};
|
|
490
|
+
exports._getJavaScriptConfiguration = _getJavaScriptConfiguration;
|
|
491
|
+
/**
|
|
492
|
+
* Main method for generating a webpack configuration
|
|
493
|
+
* @param environment
|
|
494
|
+
* @param type
|
|
495
|
+
*/
|
|
496
|
+
exports.default = (function (environment, type) {
|
|
497
|
+
var config = exports._getBase(environment);
|
|
498
|
+
if (type === __1.WebpackType.Static) {
|
|
499
|
+
return exports._getStaticConfiguration(config, environment);
|
|
500
|
+
}
|
|
501
|
+
if (type === __1.WebpackType.JavaScript) {
|
|
502
|
+
return exports._getJavaScriptConfiguration(config, environment);
|
|
503
|
+
}
|
|
504
|
+
return exports._getJavaScriptConfiguration(exports._getStaticConfiguration(config, environment), environment);
|
|
505
|
+
});
|
|
506
|
+
//# sourceMappingURL=webpack.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.config.js","sourceRoot":"","sources":["../../src/webpack/webpack.config.ts"],"names":[],"mappings":";AAAA,8GAA8G;AAC9G,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvC,yFAAiE;AACjE,iFAAyD;AACzD,+GAA0E;AAC1E,yDAAqD;AACrD,uDAA8D;AAC9D,qDAAmG;AACnG,kGAAwE;AACxE,4EAAoD;AACpD,0EAAkD;AAClD,gFAAiD;AACjD,mCASiB;AAEjB,qDAA2D;AAC3D,wBAAiC;AAQjC,IAAM,eAAe,GAAG,EAAE,GAAG,IAAI,CAAC;AAClC,IAAM,SAAS,GAAG,qDAAqD,CAAC;AACxE,IAAM,SAAS,GAAG;IAChB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,UAAU;IACvB,KAAK,EAAE,OAAO;IACd,aAAa,EAAE,YAAY;CAC5B,CAAC;AAEF;;;;;GAKG;AACI,IAAM,aAAa,GAAG,UAAC,aAAqB,EAAE,YAAoB,EAAE,eAAuB;IAChG,IAAM,MAAM,GAAG,oBAAG,CAAC,YAAY,EAAE,CAAC;IAClC,IAAI,CAAC,uBAAM,CAAC,SAAS,CAAC,aAAa,EAAE,UAAU,CAAC,EAAE;QAChD,IAAI,MAAM,EAAE;YACV,OAAO,CAAC,mBAAgB,MAAM,iBAAa,CAAC,CAAC;SAC9C;QAED,OAAO;YACL,mEAAgE,aAAa,oCAAgC;SAC9G,CAAC;KACH;IAED,IAAM,SAAS,GACb,MAAM,IAAI,qDAAmD,aAAa,wCAAqC,CAAC;IAElH,OAAO;QACL,uDAAoD,YAAY,0CAAsC;QACtG,2DAAwD,eAAe,8CAA0C;QACjH,mBAAgB,SAAS,iBAAa;KACvC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,aAAa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AAC,IAAI,GAAG;QACZ,MAAM,EAAE,OAAO;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,MAAM;QACX,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,OAAO;QACZ,GAAG,EAAE,OAAO;QACZ,qCAAqC;QACrC,aAAa,EAAE,OAAO;KACvB,CAAC;IACF,CAAA,KAAA,MAAM,CAAC,OAAO,CAAA,CAAC,IAAI,oCAAI,qBAAa,CAAC,WAAW,CAAC,IAAE;IAEnD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAnCW,QAAA,2BAA2B,+BAmCtC;AAEF;;;;GAIG;AACH,mBAAe,UAAC,WAAwB,EAAE,IAAiB;IACzD,IAAM,MAAM,GAAG,gBAAQ,CAAC,WAAW,CAAC,CAAC;IAErC,IAAI,IAAI,KAAK,eAAW,CAAC,MAAM,EAAE;QAC/B,OAAO,+BAAuB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;KACrD;IACD,IAAI,IAAI,KAAK,eAAW,CAAC,UAAU,EAAE;QACnC,OAAO,mCAA2B,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;KACzD;IAED,OAAO,mCAA2B,CAAC,+BAAuB,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,CAAC,CAAC;AAChG,CAAC,EAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Configuration } from 'webpack-dev-server';
|
|
2
|
+
import { WebpackType } from '..';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the base {@link Configuration}
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
export declare const _getBase: () => Configuration;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the {@link Configuration} for static type
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare const _getStaticConfiguration: (config: Configuration) => Configuration;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the {@link Configuration} for JS type
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
export declare const _getJavaScriptConfiguration: (config: Configuration) => Configuration;
|
|
18
|
+
declare const _default: (type: WebpackType) => Configuration;
|
|
19
|
+
/**
|
|
20
|
+
* Generates a webpack-dev configuration
|
|
21
|
+
*/
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._getJavaScriptConfiguration = exports._getStaticConfiguration = exports._getBase = void 0;
|
|
4
|
+
var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
|
|
5
|
+
var urls_1 = require("@twilio/flex-dev-utils/dist/urls");
|
|
6
|
+
var fs_1 = require("@twilio/flex-dev-utils/dist/fs");
|
|
7
|
+
var __1 = require("..");
|
|
8
|
+
/**
|
|
9
|
+
* Returns the base {@link Configuration}
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
// eslint-disable-next-line import/no-unused-modules
|
|
13
|
+
var _getBase = function () {
|
|
14
|
+
var local = urls_1.getLocalAndNetworkUrls(flex_dev_utils_1.env.getPort()).local;
|
|
15
|
+
return {
|
|
16
|
+
compress: true,
|
|
17
|
+
clientLogLevel: 'none',
|
|
18
|
+
quiet: true,
|
|
19
|
+
host: flex_dev_utils_1.env.getHost(),
|
|
20
|
+
port: flex_dev_utils_1.env.getPort(),
|
|
21
|
+
public: local.url,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports._getBase = _getBase;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the {@link Configuration} for static type
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
// eslint-disable-next-line import/no-unused-modules
|
|
30
|
+
var _getStaticConfiguration = function (config) {
|
|
31
|
+
config.contentBase = [fs_1.getPaths().app.publicDir, fs_1.getPaths().scripts.devAssetsDir];
|
|
32
|
+
config.contentBasePublicPath = '/';
|
|
33
|
+
config.historyApiFallback = {
|
|
34
|
+
disableDotRule: true,
|
|
35
|
+
index: '/',
|
|
36
|
+
};
|
|
37
|
+
config.publicPath = '/';
|
|
38
|
+
config.watchContentBase = true;
|
|
39
|
+
return config;
|
|
40
|
+
};
|
|
41
|
+
exports._getStaticConfiguration = _getStaticConfiguration;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the {@link Configuration} for JS type
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
// eslint-disable-next-line import/no-unused-modules
|
|
47
|
+
var _getJavaScriptConfiguration = function (config) {
|
|
48
|
+
var socket = flex_dev_utils_1.env.getWSSocket();
|
|
49
|
+
config.injectClient = false;
|
|
50
|
+
config.serveIndex = false;
|
|
51
|
+
// We're using native sockjs-node
|
|
52
|
+
config.transportMode = 'ws';
|
|
53
|
+
config.sockHost = socket.host;
|
|
54
|
+
config.sockPath = socket.path;
|
|
55
|
+
config.sockPort = socket.port;
|
|
56
|
+
// Hot reload
|
|
57
|
+
config.hot = true;
|
|
58
|
+
return config;
|
|
59
|
+
};
|
|
60
|
+
exports._getJavaScriptConfiguration = _getJavaScriptConfiguration;
|
|
61
|
+
/**
|
|
62
|
+
* Generates a webpack-dev configuration
|
|
63
|
+
*/
|
|
64
|
+
/* istanbul ignore next */
|
|
65
|
+
exports.default = (function (type) {
|
|
66
|
+
var config = exports._getBase();
|
|
67
|
+
if (type === __1.WebpackType.Static) {
|
|
68
|
+
return exports._getStaticConfiguration(config);
|
|
69
|
+
}
|
|
70
|
+
if (type === __1.WebpackType.JavaScript) {
|
|
71
|
+
return exports._getJavaScriptConfiguration(config);
|
|
72
|
+
}
|
|
73
|
+
return exports._getJavaScriptConfiguration(exports._getStaticConfiguration(config));
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=webpack.dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.dev.js","sourceRoot":"","sources":["../../src/webpack/webpack.dev.ts"],"names":[],"mappings":";;;AAAA,yDAA6C;AAC7C,yDAA0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