arui-scripts 14.1.0 → 14.1.1
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/CHANGELOG.md +7 -0
- package/build/configs/util/get-entry.d.ts +2 -1
- package/build/configs/util/get-entry.js +5 -4
- package/build/configs/webpack.client.d.ts +2 -0
- package/build/configs/webpack.client.dev.d.ts +2 -3
- package/build/configs/webpack.client.dev.js +3 -293
- package/build/configs/webpack.client.js +365 -0
- package/build/configs/webpack.client.prod.d.ts +1 -2
- package/build/configs/webpack.client.prod.js +2 -334
- package/build/configs/webpack.server.d.ts +2 -0
- package/build/configs/webpack.server.dev.d.ts +2 -3
- package/build/configs/webpack.server.dev.js +3 -228
- package/build/configs/webpack.server.js +239 -0
- package/build/configs/webpack.server.prod.d.ts +1 -2
- package/build/configs/webpack.server.prod.js +2 -192
- package/build/tsconfig-local.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -3,339 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const webpack_1 = __importDefault(require("webpack"));
|
|
8
|
-
const webpack_manifest_plugin_1 = require("webpack-manifest-plugin");
|
|
9
|
-
const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
|
|
10
|
-
const terser_webpack_plugin_1 = __importDefault(require("terser-webpack-plugin"));
|
|
11
|
-
const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
12
|
-
const compression_webpack_plugin_1 = __importDefault(require("compression-webpack-plugin"));
|
|
13
|
-
const assets_webpack_plugin_1 = __importDefault(require("assets-webpack-plugin"));
|
|
14
|
-
const tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-webpack-plugin"));
|
|
15
|
-
const getCSSModuleLocalIdent_1 = __importDefault(require("react-dev-utils/getCSSModuleLocalIdent"));
|
|
16
|
-
const PnpWebpackPlugin = require('pnp-webpack-plugin');
|
|
17
6
|
const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const babel_client_1 = __importDefault(require("./babel-client"));
|
|
21
|
-
const postcss_1 = __importDefault(require("./postcss"));
|
|
22
|
-
const check_node_version_1 = __importDefault(require("./util/check-node-version"));
|
|
23
|
-
const babel_dependencies_1 = require("./babel-dependencies");
|
|
24
|
-
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
25
|
-
const noopPath = require.resolve('./util/noop');
|
|
26
|
-
// style files regexes
|
|
27
|
-
const cssRegex = /\.css$/;
|
|
28
|
-
const cssModuleRegex = /\.module\.css$/;
|
|
29
|
-
function getSingleEntry(entryPoint) {
|
|
30
|
-
return [
|
|
31
|
-
...(Array.isArray(app_configs_1.default.clientPolyfillsEntry) ? app_configs_1.default.clientPolyfillsEntry : [app_configs_1.default.clientPolyfillsEntry]),
|
|
32
|
-
...entryPoint
|
|
33
|
-
].filter(Boolean);
|
|
34
|
-
}
|
|
35
|
-
// This is the production configuration.
|
|
36
|
-
const config = (0, apply_overrides_1.default)(['webpack', 'webpackClient', 'webpackProd', 'webpackClientProd'], {
|
|
37
|
-
mode: 'production',
|
|
38
|
-
// You may want 'eval' instead if you prefer to see the compiled output in DevTools.
|
|
39
|
-
devtool: 'cheap-module-source-map',
|
|
40
|
-
// In production, we only want to load the polyfills and the app code.
|
|
41
|
-
entry: (0, get_entry_1.default)(app_configs_1.default.clientEntry, getSingleEntry),
|
|
42
|
-
bail: true,
|
|
43
|
-
context: app_configs_1.default.cwd,
|
|
44
|
-
output: {
|
|
45
|
-
pathinfo: false,
|
|
46
|
-
path: app_configs_1.default.clientOutputPath,
|
|
47
|
-
publicPath: app_configs_1.default.publicPath,
|
|
48
|
-
filename: '[name].[chunkhash:8].js',
|
|
49
|
-
chunkFilename: '[name].[chunkhash:8].chunk.js',
|
|
50
|
-
// Point sourcemap entries to original disk location (format as URL on Windows)
|
|
51
|
-
devtoolModuleFilenameTemplate: (info) => path_1.default
|
|
52
|
-
.relative(app_configs_1.default.appSrc, info.absoluteResourcePath)
|
|
53
|
-
.replace(/\\/g, '/'),
|
|
54
|
-
},
|
|
55
|
-
optimization: {
|
|
56
|
-
splitChunks: {
|
|
57
|
-
chunks: "all",
|
|
58
|
-
cacheGroups: {
|
|
59
|
-
commons: {
|
|
60
|
-
chunks: "initial",
|
|
61
|
-
minChunks: 2,
|
|
62
|
-
maxInitialRequests: 5,
|
|
63
|
-
minSize: 0 // This is example is too small to create commons chunks
|
|
64
|
-
},
|
|
65
|
-
vendor: {
|
|
66
|
-
test: /node_modules/,
|
|
67
|
-
chunks: "initial",
|
|
68
|
-
name: "vendor",
|
|
69
|
-
priority: 10,
|
|
70
|
-
enforce: true
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
minimize: true,
|
|
75
|
-
minimizer: [
|
|
76
|
-
// This is only used in production mode
|
|
77
|
-
new terser_webpack_plugin_1.default({
|
|
78
|
-
terserOptions: {
|
|
79
|
-
parse: {
|
|
80
|
-
// we want terser to parse ecma 8 code. However, we don't want it
|
|
81
|
-
// to apply any minfication steps that turns valid ecma 5 code
|
|
82
|
-
// into invalid ecma 5 code. This is why the 'compress' and 'output'
|
|
83
|
-
// sections only apply transformations that are ecma 5 safe
|
|
84
|
-
// https://github.com/facebook/create-react-app/pull/4234
|
|
85
|
-
ecma: 2017,
|
|
86
|
-
},
|
|
87
|
-
compress: {
|
|
88
|
-
ecma: 5,
|
|
89
|
-
// Disabled because of an issue with Uglify breaking seemingly valid code:
|
|
90
|
-
// https://github.com/facebook/create-react-app/issues/2376
|
|
91
|
-
// Pending further investigation:
|
|
92
|
-
// https://github.com/mishoo/UglifyJS2/issues/2011
|
|
93
|
-
comparisons: false,
|
|
94
|
-
// Disabled because of an issue with Terser breaking valid code:
|
|
95
|
-
// https://github.com/facebook/create-react-app/issues/5250
|
|
96
|
-
// Pending futher investigation:
|
|
97
|
-
// https://github.com/terser-js/terser/issues/120
|
|
98
|
-
inline: 2,
|
|
99
|
-
},
|
|
100
|
-
mangle: {
|
|
101
|
-
safari10: true,
|
|
102
|
-
},
|
|
103
|
-
output: {
|
|
104
|
-
ecma: 5,
|
|
105
|
-
comments: false,
|
|
106
|
-
// Turned on because emoji and regex is not minified properly using default
|
|
107
|
-
// https://github.com/facebook/create-react-app/issues/2488
|
|
108
|
-
ascii_only: true,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
// Use multi-process parallel running to improve the build speed
|
|
112
|
-
// Default number of concurrent runs: os.cpus().length - 1
|
|
113
|
-
parallel: true,
|
|
114
|
-
}),
|
|
115
|
-
new CssMinimizerPlugin()
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
resolve: {
|
|
119
|
-
// This allows you to set a fallback for where Webpack should look for modules.
|
|
120
|
-
// We placed these paths second because we want `node_modules` to "win"
|
|
121
|
-
// if there are any conflicts. This matches Node resolution mechanism.
|
|
122
|
-
// https://github.com/facebookincubator/create-react-app/issues/253
|
|
123
|
-
modules: ['node_modules', app_configs_1.default.appNodeModules],
|
|
124
|
-
// These are the reasonable defaults supported by the Node ecosystem.
|
|
125
|
-
// We also include JSX as a common component filename extension to support
|
|
126
|
-
// some tools, although we do not recommend using it, see:
|
|
127
|
-
// https://github.com/facebookincubator/create-react-app/issues/290
|
|
128
|
-
// `web` extension prefixes have been added for better support
|
|
129
|
-
// for React Native Web.
|
|
130
|
-
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx', '.ts', '.tsx'],
|
|
131
|
-
plugins: ([
|
|
132
|
-
(app_configs_1.default.tsconfig && new tsconfig_paths_webpack_plugin_1.default({
|
|
133
|
-
configFile: app_configs_1.default.tsconfig,
|
|
134
|
-
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx', '.ts', '.tsx']
|
|
135
|
-
})),
|
|
136
|
-
].filter(Boolean)),
|
|
137
|
-
},
|
|
138
|
-
resolveLoader: {
|
|
139
|
-
plugins: [
|
|
140
|
-
PnpWebpackPlugin.moduleLoader(module),
|
|
141
|
-
],
|
|
142
|
-
},
|
|
143
|
-
module: {
|
|
144
|
-
// typescript interface will be removed from modules, and we will get an error on correct code
|
|
145
|
-
// see https://github.com/webpack/webpack/issues/7378
|
|
146
|
-
strictExportPresence: !app_configs_1.default.tsconfig,
|
|
147
|
-
rules: [
|
|
148
|
-
{
|
|
149
|
-
// "oneOf" will traverse all following loaders until one will
|
|
150
|
-
// match the requirements. When no loader matches it will fall
|
|
151
|
-
// back to the "file" loader at the end of the loader list.
|
|
152
|
-
oneOf: ([
|
|
153
|
-
{
|
|
154
|
-
test: [/\.svg$/],
|
|
155
|
-
loader: require.resolve('svg-url-loader'),
|
|
156
|
-
options: {
|
|
157
|
-
limit: 10000,
|
|
158
|
-
iesafe: true,
|
|
159
|
-
name: '[name].[hash:8].[ext]',
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
// "url" loader works like "file" loader except that it embeds assets
|
|
163
|
-
// smaller than specified limit in bytes as data URLs to avoid requests.
|
|
164
|
-
// A missing `test` is equivalent to a match.
|
|
165
|
-
{
|
|
166
|
-
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
|
|
167
|
-
loader: require.resolve('url-loader'),
|
|
168
|
-
options: {
|
|
169
|
-
limit: 10000,
|
|
170
|
-
name: '[name].[hash:8].[ext]',
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
// Process JS with Babel.
|
|
174
|
-
{
|
|
175
|
-
test: app_configs_1.default.useTscLoader ? /\.(js|jsx|mjs|cjs)$/ : /\.(js|jsx|mjs|ts|tsx|cjs)$/,
|
|
176
|
-
include: app_configs_1.default.appSrc,
|
|
177
|
-
loader: require.resolve('babel-loader'),
|
|
178
|
-
options: babel_client_1.default,
|
|
179
|
-
},
|
|
180
|
-
(app_configs_1.default.tsconfig && app_configs_1.default.useTscLoader) && {
|
|
181
|
-
test: /\.tsx?$/,
|
|
182
|
-
use: [
|
|
183
|
-
{
|
|
184
|
-
loader: require.resolve('babel-loader'),
|
|
185
|
-
options: Object.assign({
|
|
186
|
-
// This is a feature of `babel-loader` for webpack (not Babel itself).
|
|
187
|
-
// It enables caching results in ./node_modules/.cache/babel-loader/
|
|
188
|
-
// directory for faster rebuilds.
|
|
189
|
-
cacheDirectory: true
|
|
190
|
-
}, babel_client_1.default)
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
loader: require.resolve('ts-loader'),
|
|
194
|
-
options: {
|
|
195
|
-
onlyCompileBundledFiles: true,
|
|
196
|
-
happyPackMode: true,
|
|
197
|
-
configFile: app_configs_1.default.tsconfig
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
]
|
|
201
|
-
},
|
|
202
|
-
// Process any JS outside of the app with Babel.
|
|
203
|
-
// Unlike the application JS, we only compile the standard ES features.
|
|
204
|
-
{
|
|
205
|
-
test: /\.(js|mjs)$/,
|
|
206
|
-
exclude: /@babel(?:\/|\\{1,2})runtime/,
|
|
207
|
-
loader: require.resolve('babel-loader'),
|
|
208
|
-
options: Object.assign(Object.assign({}, babel_dependencies_1.babelDependencies), { babelrc: false, configFile: false, compact: false, cacheDirectory: true, cacheCompression: false }),
|
|
209
|
-
},
|
|
210
|
-
// The notation here is somewhat confusing.
|
|
211
|
-
// "postcss" loader applies autoprefixer to our CSS.
|
|
212
|
-
// "css" loader resolves paths in CSS and adds assets as dependencies.
|
|
213
|
-
// "style" loader normally turns CSS into JS modules injecting <style>,
|
|
214
|
-
// but unlike in development configuration, we do something different.
|
|
215
|
-
// `ExtractTextPlugin` first applies the "postcss" and "css" loaders
|
|
216
|
-
// (second argument), then grabs the result CSS and puts it into a
|
|
217
|
-
// separate file in our build process. This way we actually ship
|
|
218
|
-
// a single CSS file in production instead of JS code injecting <style>
|
|
219
|
-
// tags. If you use code splitting, however, any async bundles will still
|
|
220
|
-
// use the "style" loader inside the async code so CSS from them won't be
|
|
221
|
-
// in the main CSS file.
|
|
222
|
-
{
|
|
223
|
-
test: cssRegex,
|
|
224
|
-
exclude: cssModuleRegex,
|
|
225
|
-
use: [
|
|
226
|
-
{
|
|
227
|
-
loader: mini_css_extract_plugin_1.default.loader,
|
|
228
|
-
options: { publicPath: './' }
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
loader: require.resolve('css-loader'),
|
|
232
|
-
options: {
|
|
233
|
-
importLoaders: 1,
|
|
234
|
-
sourceMap: false,
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
loader: require.resolve('postcss-loader'),
|
|
239
|
-
options: {
|
|
240
|
-
// Necessary for external CSS imports to work
|
|
241
|
-
// https://github.com/facebookincubator/create-react-app/issues/2677
|
|
242
|
-
ident: 'postcss',
|
|
243
|
-
plugins: () => postcss_1.default,
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
],
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
test: cssModuleRegex,
|
|
250
|
-
use: [
|
|
251
|
-
{
|
|
252
|
-
loader: mini_css_extract_plugin_1.default.loader,
|
|
253
|
-
options: { publicPath: './' }
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
loader: require.resolve('css-loader'),
|
|
257
|
-
options: {
|
|
258
|
-
importLoaders: 1,
|
|
259
|
-
sourceMap: false,
|
|
260
|
-
modules: {
|
|
261
|
-
getLocalIdent: getCSSModuleLocalIdent_1.default
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
loader: require.resolve('postcss-loader'),
|
|
267
|
-
options: {
|
|
268
|
-
// Necessary for external CSS imports to work
|
|
269
|
-
// https://github.com/facebookincubator/create-react-app/issues/2677
|
|
270
|
-
ident: 'postcss',
|
|
271
|
-
plugins: () => postcss_1.default,
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
},
|
|
276
|
-
// "file" loader makes sure those assets get served by WebpackDevServer.
|
|
277
|
-
// When you `import` an asset, you get its (virtual) filename.
|
|
278
|
-
// In production, they would get copied to the `build` folder.
|
|
279
|
-
// This loader doesn't use a "test" so it will catch all modules
|
|
280
|
-
// that fall through the other loaders.
|
|
281
|
-
{
|
|
282
|
-
// Exclude `js` files to keep "css" loader working as it injects
|
|
283
|
-
// its runtime that would otherwise processed through "file" loader.
|
|
284
|
-
// Also exclude `html` and `json` extensions so they get processed
|
|
285
|
-
// by webpacks internal loaders.
|
|
286
|
-
exclude: [/\.(js|jsx|mjs|ts|tsx)$/, /\.(html|ejs)$/, /\.json$/],
|
|
287
|
-
loader: require.resolve('file-loader'),
|
|
288
|
-
options: {
|
|
289
|
-
name: 'static/media/[name].[hash:8].[ext]',
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
].filter(Boolean)),
|
|
293
|
-
},
|
|
294
|
-
// ** STOP ** Are you adding a new loader?
|
|
295
|
-
// Make sure to add the new loader(s) before the "file" loader.
|
|
296
|
-
],
|
|
297
|
-
},
|
|
298
|
-
plugins: ([
|
|
299
|
-
new assets_webpack_plugin_1.default({ path: app_configs_1.default.serverOutputPath }),
|
|
300
|
-
new webpack_1.default.DefinePlugin({
|
|
301
|
-
// Tell Webpack to provide empty mocks for process.env.
|
|
302
|
-
'process.env': '{}'
|
|
303
|
-
}),
|
|
304
|
-
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
|
|
305
|
-
new mini_css_extract_plugin_1.default({
|
|
306
|
-
filename: '[name].[contenthash:8].css',
|
|
307
|
-
chunkFilename: '[name].[contenthash:8].chunk.css',
|
|
308
|
-
}),
|
|
309
|
-
new webpack_manifest_plugin_1.WebpackManifestPlugin(),
|
|
310
|
-
new compression_webpack_plugin_1.default({
|
|
311
|
-
filename: '[file].gz',
|
|
312
|
-
algorithm: 'gzip',
|
|
313
|
-
test: /\.js$|\.css$|\.png$|\.svg$/,
|
|
314
|
-
threshold: 10240,
|
|
315
|
-
minRatio: 0.8
|
|
316
|
-
}),
|
|
317
|
-
(0, check_node_version_1.default)(10) && new compression_webpack_plugin_1.default({
|
|
318
|
-
filename: '[file].br',
|
|
319
|
-
algorithm: 'brotliCompress',
|
|
320
|
-
test: /\.(js|css|html|svg)$/,
|
|
321
|
-
compressionOptions: {
|
|
322
|
-
level: 11,
|
|
323
|
-
},
|
|
324
|
-
threshold: 10240,
|
|
325
|
-
minRatio: 0.8,
|
|
326
|
-
}),
|
|
327
|
-
app_configs_1.default.tsconfig !== null && new fork_ts_checker_webpack_plugin_1.default(),
|
|
328
|
-
].filter(Boolean).concat(
|
|
329
|
-
// Ignore prop-types packages in production mode
|
|
330
|
-
// This should works fine, since proptypes usage should be eliminated in production mode
|
|
331
|
-
app_configs_1.default.keepPropTypes
|
|
332
|
-
? []
|
|
333
|
-
: [
|
|
334
|
-
new webpack_1.default.NormalModuleReplacementPlugin(/^react-style-proptype$/, noopPath),
|
|
335
|
-
new webpack_1.default.NormalModuleReplacementPlugin(/^thrift-services\/proptypes/, noopPath)
|
|
336
|
-
])),
|
|
337
|
-
experiments: {
|
|
338
|
-
backCompat: app_configs_1.default.webpack4Compatibility,
|
|
339
|
-
},
|
|
340
|
-
});
|
|
7
|
+
const webpack_client_1 = require("./webpack.client");
|
|
8
|
+
const config = (0, apply_overrides_1.default)(['webpack', 'webpackClient', 'webpackProd', 'webpackClientProd'], (0, webpack_client_1.createClientWebpackConfig)('prod'));
|
|
341
9
|
exports.default = config;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export default webpackServerDev;
|
|
1
|
+
declare const config: import("webpack").Configuration;
|
|
2
|
+
export default config;
|
|
@@ -3,232 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const webpack_1 = __importDefault(require("webpack"));
|
|
9
|
-
const case_sensitive_paths_webpack_plugin_1 = __importDefault(require("case-sensitive-paths-webpack-plugin"));
|
|
10
|
-
const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
11
|
-
const run_script_webpack_plugin_1 = require("run-script-webpack-plugin");
|
|
12
|
-
const webpack_node_externals_1 = __importDefault(require("webpack-node-externals"));
|
|
13
|
-
const WatchMissingNodeModulesPlugin_1 = __importDefault(require("react-dev-utils/WatchMissingNodeModulesPlugin"));
|
|
14
|
-
const tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-webpack-plugin"));
|
|
15
|
-
const getCSSModuleLocalIdent_1 = __importDefault(require("react-dev-utils/getCSSModuleLocalIdent"));
|
|
16
|
-
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
17
|
-
const babel_server_1 = __importDefault(require("./babel-server"));
|
|
18
|
-
const postcss_1 = __importDefault(require("./postcss"));
|
|
19
6
|
const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const ReloadServerPlugin = require('../plugins/reload-server-webpack-plugin');
|
|
24
|
-
const assetsIgnoreBanner = fs_1.default.readFileSync(require.resolve('./util/node-assets-ignore'), 'utf8');
|
|
25
|
-
// style files regexes
|
|
26
|
-
const cssRegex = /\.css$/;
|
|
27
|
-
const cssModuleRegex = /\.module\.css$/;
|
|
28
|
-
function getSingleEntry(entryPoint) {
|
|
29
|
-
const prefix = app_configs_1.default.useServerHMR ? [`${require.resolve('webpack/hot/poll')}?1000`] : [];
|
|
30
|
-
return [...prefix, ...entryPoint];
|
|
31
|
-
}
|
|
32
|
-
// This is the development configuration.
|
|
33
|
-
// It is focused on developer experience and fast rebuilds.
|
|
34
|
-
// The production configuration is different and lives in a separate file.
|
|
35
|
-
const config = {
|
|
36
|
-
mode: 'development',
|
|
37
|
-
devtool: app_configs_1.default.devSourceMaps,
|
|
38
|
-
target: 'node',
|
|
39
|
-
node: {
|
|
40
|
-
__filename: true,
|
|
41
|
-
__dirname: true
|
|
42
|
-
},
|
|
43
|
-
entry: (0, get_entry_1.default)(app_configs_1.default.serverEntry, getSingleEntry),
|
|
44
|
-
context: app_configs_1.default.cwd,
|
|
45
|
-
output: {
|
|
46
|
-
// Add /* filename */ comments to generated require()s in the output.
|
|
47
|
-
pathinfo: true,
|
|
48
|
-
path: app_configs_1.default.serverOutputPath,
|
|
49
|
-
publicPath: app_configs_1.default.publicPath,
|
|
50
|
-
filename: app_configs_1.default.serverOutput,
|
|
51
|
-
chunkFilename: '[name].js',
|
|
52
|
-
// Point sourcemap entries to original disk location (format as URL on Windows)
|
|
53
|
-
devtoolModuleFilenameTemplate: (info) => path_1.default
|
|
54
|
-
.relative(app_configs_1.default.appSrc, info.absoluteResourcePath)
|
|
55
|
-
.replace(/\\/g, '/'),
|
|
56
|
-
},
|
|
57
|
-
cache: {
|
|
58
|
-
type: 'filesystem',
|
|
59
|
-
name: 'server',
|
|
60
|
-
buildDependencies: {
|
|
61
|
-
config: [__filename],
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
externalsPresets: { node: true },
|
|
65
|
-
externals: [(0, webpack_node_externals_1.default)({
|
|
66
|
-
allowlist: server_externals_exemptions_1.serverExternalsExemptions,
|
|
67
|
-
modulesFromFile: true,
|
|
68
|
-
})],
|
|
69
|
-
resolve: {
|
|
70
|
-
// This allows you to set a fallback for where Webpack should look for modules.
|
|
71
|
-
// We placed these paths second because we want `node_modules` to "win"
|
|
72
|
-
// if there are any conflicts. This matches Node resolution mechanism.
|
|
73
|
-
// https://github.com/facebookincubator/create-react-app/issues/253
|
|
74
|
-
modules: ['node_modules', app_configs_1.default.appNodeModules],
|
|
75
|
-
// These are the reasonable defaults supported by the Node ecosystem.
|
|
76
|
-
// We also include JSX as a common component filename extension to support
|
|
77
|
-
// some tools, although we do not recommend using it, see:
|
|
78
|
-
// https://github.com/facebookincubator/create-react-app/issues/290
|
|
79
|
-
// `web` extension prefixes have been added for better support
|
|
80
|
-
// for React Native Web.
|
|
81
|
-
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx', '.ts', '.tsx'],
|
|
82
|
-
plugins: ([
|
|
83
|
-
(app_configs_1.default.tsconfig && new tsconfig_paths_webpack_plugin_1.default({
|
|
84
|
-
configFile: app_configs_1.default.tsconfig,
|
|
85
|
-
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx', '.ts', '.tsx']
|
|
86
|
-
}))
|
|
87
|
-
].filter(Boolean)),
|
|
88
|
-
},
|
|
89
|
-
module: {
|
|
90
|
-
// typescript interface will be removed from modules, and we will get an error on correct code
|
|
91
|
-
// see https://github.com/webpack/webpack/issues/7378
|
|
92
|
-
strictExportPresence: !app_configs_1.default.tsconfig,
|
|
93
|
-
rules: [
|
|
94
|
-
{
|
|
95
|
-
oneOf: ([
|
|
96
|
-
// Process JS with Babel.
|
|
97
|
-
{
|
|
98
|
-
test: app_configs_1.default.useTscLoader ? /\.(js|jsx|mjs)$/ : /\.(js|jsx|mjs|ts|tsx)$/,
|
|
99
|
-
include: app_configs_1.default.appSrc,
|
|
100
|
-
loader: require.resolve('babel-loader'),
|
|
101
|
-
options: Object.assign({
|
|
102
|
-
// This is a feature of `babel-loader` for webpack (not Babel itself).
|
|
103
|
-
// It enables caching results in ./node_modules/.cache/babel-loader/
|
|
104
|
-
// directory for faster rebuilds.
|
|
105
|
-
cacheDirectory: true,
|
|
106
|
-
}, babel_server_1.default),
|
|
107
|
-
},
|
|
108
|
-
(app_configs_1.default.tsconfig && app_configs_1.default.useTscLoader) && {
|
|
109
|
-
test: /\.tsx?$/,
|
|
110
|
-
use: [
|
|
111
|
-
{
|
|
112
|
-
loader: require.resolve('babel-loader'),
|
|
113
|
-
options: Object.assign({
|
|
114
|
-
// This is a feature of `babel-loader` for webpack (not Babel itself).
|
|
115
|
-
// It enables caching results in ./node_modules/.cache/babel-loader/
|
|
116
|
-
// directory for faster rebuilds.
|
|
117
|
-
cacheDirectory: true
|
|
118
|
-
}, babel_server_1.default)
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
loader: require.resolve('ts-loader'),
|
|
122
|
-
options: {
|
|
123
|
-
onlyCompileBundledFiles: true,
|
|
124
|
-
transpileOnly: true,
|
|
125
|
-
happyPackMode: true,
|
|
126
|
-
configFile: app_configs_1.default.tsconfig
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
},
|
|
131
|
-
// Process any JS outside of the app with Babel.
|
|
132
|
-
// Unlike the application JS, we only compile the standard ES features.
|
|
133
|
-
{
|
|
134
|
-
test: /\.(js|mjs)$/,
|
|
135
|
-
exclude: /@babel(?:\/|\\{1,2})runtime/,
|
|
136
|
-
loader: require.resolve('babel-loader'),
|
|
137
|
-
options: Object.assign(Object.assign({}, babel_dependencies_1.babelDependencies), { babelrc: false, configFile: false, compact: false, cacheDirectory: true, cacheCompression: false }),
|
|
138
|
-
},
|
|
139
|
-
// replace css imports with empty files
|
|
140
|
-
{
|
|
141
|
-
test: cssRegex,
|
|
142
|
-
exclude: cssModuleRegex,
|
|
143
|
-
loader: require.resolve('null-loader')
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
test: cssModuleRegex,
|
|
147
|
-
use: [
|
|
148
|
-
{
|
|
149
|
-
loader: require.resolve('css-loader'),
|
|
150
|
-
options: {
|
|
151
|
-
modules: {
|
|
152
|
-
exportOnlyLocals: true,
|
|
153
|
-
getLocalIdent: getCSSModuleLocalIdent_1.default
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
loader: require.resolve('postcss-loader'),
|
|
159
|
-
options: {
|
|
160
|
-
// Necessary for external CSS imports to work
|
|
161
|
-
// https://github.com/facebookincubator/create-react-app/issues/2677
|
|
162
|
-
ident: 'postcss',
|
|
163
|
-
plugins: () => postcss_1.default,
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
],
|
|
167
|
-
},
|
|
168
|
-
// "file" loader makes sure those assets get served by WebpackDevServer.
|
|
169
|
-
// When you `import` an asset, you get its (virtual) filename.
|
|
170
|
-
// In production, they would get copied to the `build` folder.
|
|
171
|
-
// This loader doesn't use a "test" so it will catch all modules
|
|
172
|
-
// that fall through the other loaders.
|
|
173
|
-
{
|
|
174
|
-
// Exclude `js` files to keep "css" loader working as it injects
|
|
175
|
-
// its runtime that would otherwise processed through "file" loader.
|
|
176
|
-
// Also exclude `html` and `json` extensions so they get processed
|
|
177
|
-
// by webpacks internal loaders.
|
|
178
|
-
exclude: [/\.(js|jsx|mjs|ts|tsx)$/, /\.(html|ejs)$/, /\.json$/],
|
|
179
|
-
loader: require.resolve('file-loader'),
|
|
180
|
-
options: {
|
|
181
|
-
outputPath: app_configs_1.default.publicPath,
|
|
182
|
-
publicPath: app_configs_1.default.publicPath,
|
|
183
|
-
name: 'static/media/[name].[hash:8].[ext]',
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
].filter(Boolean)),
|
|
187
|
-
},
|
|
188
|
-
],
|
|
189
|
-
},
|
|
190
|
-
optimization: {
|
|
191
|
-
nodeEnv: false,
|
|
192
|
-
},
|
|
193
|
-
plugins: ([
|
|
194
|
-
app_configs_1.default.useServerHMR
|
|
195
|
-
? new run_script_webpack_plugin_1.RunScriptWebpackPlugin({
|
|
196
|
-
name: app_configs_1.default.serverOutput
|
|
197
|
-
})
|
|
198
|
-
: new ReloadServerPlugin({ script: path_1.default.join(app_configs_1.default.serverOutputPath, app_configs_1.default.serverOutput) }),
|
|
199
|
-
new webpack_1.default.NoEmitOnErrorsPlugin(),
|
|
200
|
-
new webpack_1.default.BannerPlugin({
|
|
201
|
-
banner: assetsIgnoreBanner,
|
|
202
|
-
raw: true,
|
|
203
|
-
entryOnly: false
|
|
204
|
-
}),
|
|
205
|
-
new webpack_1.default.DefinePlugin({
|
|
206
|
-
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
|
|
207
|
-
}),
|
|
208
|
-
// Watcher doesn't work well if you mistype casing in a path so we use
|
|
209
|
-
// a plugin that prints an error when you attempt to do this.
|
|
210
|
-
// See https://github.com/facebookincubator/create-react-app/issues/240
|
|
211
|
-
new case_sensitive_paths_webpack_plugin_1.default(),
|
|
212
|
-
// If you require a missing module and then `npm install` it, you still have
|
|
213
|
-
// to restart the development server for Webpack to discover it. This plugin
|
|
214
|
-
// makes the discovery automatic so you don't have to restart.
|
|
215
|
-
// See https://github.com/facebookincubator/create-react-app/issues/186
|
|
216
|
-
new WatchMissingNodeModulesPlugin_1.default(app_configs_1.default.appNodeModules),
|
|
217
|
-
app_configs_1.default.tsconfig !== null && new fork_ts_checker_webpack_plugin_1.default(),
|
|
218
|
-
app_configs_1.default.useServerHMR && new webpack_1.default.HotModuleReplacementPlugin(),
|
|
219
|
-
].filter(Boolean)),
|
|
220
|
-
// Turn off performance hints during development because we don't do any
|
|
221
|
-
// splitting or minification in interest of speed. These warnings become
|
|
222
|
-
// cumbersome.
|
|
223
|
-
performance: {
|
|
224
|
-
hints: false,
|
|
225
|
-
},
|
|
226
|
-
experiments: {
|
|
227
|
-
backCompat: app_configs_1.default.webpack4Compatibility,
|
|
228
|
-
},
|
|
229
|
-
watchOptions: {
|
|
230
|
-
ignored: /node_modules/,
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
const webpackServerDev = (0, apply_overrides_1.default)(['webpack', 'webpackServer', 'webpackDev', 'webpackServerDev'], config);
|
|
234
|
-
exports.default = webpackServerDev;
|
|
7
|
+
const webpack_server_1 = require("./webpack.server");
|
|
8
|
+
const config = (0, apply_overrides_1.default)(['webpack', 'webpackServer', 'webpackDev', 'webpackServerDev'], (0, webpack_server_1.createServerConfig)('dev'));
|
|
9
|
+
exports.default = config;
|