package-build-stats 7.3.8 → 7.3.10
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/build/common.types.d.ts +53 -31
- package/build/common.types.js +2 -2
- package/build/config/config.d.ts +3 -3
- package/build/config/config.js +10 -8
- package/build/config/makeWebpackConfig.d.ts +16 -10
- package/build/config/makeWebpackConfig.js +231 -214
- package/build/errors/CustomError.d.ts +23 -20
- package/build/errors/CustomError.js +57 -57
- package/build/getDependencySizeTree.d.ts +12 -6
- package/build/getDependencySizeTree.js +269 -224
- package/build/getPackageExportSizes.d.ts +63 -44
- package/build/getPackageExportSizes.js +116 -71
- package/build/getPackageStats.d.ts +91 -69
- package/build/getPackageStats.js +128 -80
- package/build/getParseTime.d.ts +13 -8
- package/build/getParseTime.js +57 -45
- package/build/index.d.ts +5 -5
- package/build/index.js +54 -24
- package/build/utils/build.utils.d.ts +121 -78
- package/build/utils/build.utils.js +337 -249
- package/build/utils/common.utils.d.ts +22 -13
- package/build/utils/common.utils.js +111 -93
- package/build/utils/exports.utils.d.ts +14 -8
- package/build/utils/exports.utils.js +253 -219
- package/build/utils/installation.utils.d.ts +11 -7
- package/build/utils/installation.utils.js +150 -119
- package/build/utils/telemetry.utils.d.ts +69 -13
- package/build/utils/telemetry.utils.js +169 -122
- package/package.json +2 -3
- package/build/fixed/parseReference.js +0 -5353
package/build/common.types.d.ts
CHANGED
|
@@ -1,34 +1,56 @@
|
|
|
1
|
-
declare type Minifier = 'esbuild' | 'terser'
|
|
1
|
+
declare type Minifier = 'esbuild' | 'terser'
|
|
2
2
|
declare type AllOptions = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
export declare type BuildPackageOptions = Pick<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
3
|
+
customImports?: Array<string>
|
|
4
|
+
splitCustomImports?: boolean
|
|
5
|
+
debug?: boolean
|
|
6
|
+
calcParse?: boolean
|
|
7
|
+
esm?: boolean
|
|
8
|
+
entryFilename?: string
|
|
9
|
+
client?: 'npm' | 'yarn'
|
|
10
|
+
limitConcurrency?: boolean
|
|
11
|
+
networkConcurrency?: number
|
|
12
|
+
additionalPackages?: Array<string>
|
|
13
|
+
isLocal?: boolean
|
|
14
|
+
installTimeout?: number
|
|
15
|
+
}
|
|
16
|
+
export declare type BuildPackageOptions = Pick<
|
|
17
|
+
AllOptions,
|
|
18
|
+
'customImports' | 'splitCustomImports' | 'debug' | 'calcParse'
|
|
19
|
+
> & {
|
|
20
|
+
includeDependencySizes: boolean
|
|
21
|
+
minifier: Minifier
|
|
22
|
+
}
|
|
23
|
+
export declare type CreateEntryPointOptions = Pick<
|
|
24
|
+
AllOptions,
|
|
25
|
+
'esm' | 'customImports' | 'entryFilename'
|
|
26
|
+
>
|
|
27
|
+
export declare type InstallPackageOptions = Pick<
|
|
28
|
+
AllOptions,
|
|
29
|
+
| 'client'
|
|
30
|
+
| 'limitConcurrency'
|
|
31
|
+
| 'networkConcurrency'
|
|
32
|
+
| 'additionalPackages'
|
|
33
|
+
| 'isLocal'
|
|
34
|
+
| 'installTimeout'
|
|
35
|
+
>
|
|
36
|
+
export declare type GetPackageStatsOptions = Pick<
|
|
37
|
+
AllOptions,
|
|
38
|
+
| 'client'
|
|
39
|
+
| 'limitConcurrency'
|
|
40
|
+
| 'networkConcurrency'
|
|
41
|
+
| 'debug'
|
|
42
|
+
| 'customImports'
|
|
43
|
+
| 'installTimeout'
|
|
44
|
+
> & {
|
|
45
|
+
minifier?: Minifier
|
|
46
|
+
}
|
|
25
47
|
export declare type Externals = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
48
|
+
externalPackages: Array<string>
|
|
49
|
+
externalBuiltIns: Array<string>
|
|
50
|
+
}
|
|
29
51
|
export declare type WebpackError = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
export {}
|
|
52
|
+
name: 'ModuleNotFoundError'
|
|
53
|
+
details?: string
|
|
54
|
+
error: Error
|
|
55
|
+
}
|
|
56
|
+
export {}
|
package/build/common.types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
package/build/config/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
export default _default
|
|
2
|
+
tmp: string
|
|
3
|
+
}
|
|
4
|
+
export default _default
|
package/build/config/config.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict'
|
|
2
2
|
// Use ES6 supported by Node v6.10 only!
|
|
3
|
-
var __importDefault =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
var __importDefault =
|
|
4
|
+
(this && this.__importDefault) ||
|
|
5
|
+
function (mod) {
|
|
6
|
+
return mod && mod.__esModule ? mod : { default: mod }
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
9
|
+
const path_1 = __importDefault(require('path'))
|
|
8
10
|
exports.default = {
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
+
tmp: path_1.default.join('/tmp', 'tmp-build'),
|
|
12
|
+
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import webpack, { Entry } from 'webpack'
|
|
2
|
-
import { Externals } from '../common.types'
|
|
1
|
+
import webpack, { Entry } from 'webpack'
|
|
2
|
+
import { Externals } from '../common.types'
|
|
3
3
|
declare type MakeWebpackConfigOptions = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
export default function makeWebpackConfig({
|
|
11
|
-
|
|
4
|
+
packageName: string
|
|
5
|
+
externals: Externals
|
|
6
|
+
debug?: boolean
|
|
7
|
+
entry: string | string[] | Entry
|
|
8
|
+
minifier: 'esbuild' | 'terser'
|
|
9
|
+
}
|
|
10
|
+
export default function makeWebpackConfig({
|
|
11
|
+
packageName,
|
|
12
|
+
entry,
|
|
13
|
+
externals,
|
|
14
|
+
debug,
|
|
15
|
+
minifier,
|
|
16
|
+
}: MakeWebpackConfigOptions): webpack.Configuration
|
|
17
|
+
export {}
|
|
@@ -1,225 +1,242 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
1
|
+
'use strict'
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod }
|
|
6
|
+
}
|
|
7
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
8
|
+
const autoprefixer_1 = __importDefault(require('autoprefixer'))
|
|
9
|
+
const terser_webpack_plugin_1 = __importDefault(
|
|
10
|
+
require('terser-webpack-plugin')
|
|
11
|
+
)
|
|
12
|
+
const mini_css_extract_plugin_1 = __importDefault(
|
|
13
|
+
require('mini-css-extract-plugin')
|
|
14
|
+
)
|
|
15
|
+
const csso_webpack_plugin_1 = __importDefault(require('csso-webpack-plugin'))
|
|
16
|
+
const write_file_webpack_plugin_1 = __importDefault(
|
|
17
|
+
require('write-file-webpack-plugin')
|
|
18
|
+
)
|
|
19
|
+
const log = require('debug')('bp:webpack')
|
|
20
|
+
const escape_string_regexp_1 = __importDefault(require('escape-string-regexp'))
|
|
21
|
+
const builtin_modules_1 = __importDefault(require('builtin-modules'))
|
|
22
|
+
const webpack_1 = __importDefault(require('webpack'))
|
|
23
|
+
const esbuild_loader_1 = require('esbuild-loader')
|
|
16
24
|
// @ts-ignore
|
|
17
|
-
const plugin_1 = __importDefault(require(
|
|
18
|
-
function makeWebpackConfig({ packageName, entry, externals, debug, minifier
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
25
|
+
const plugin_1 = __importDefault(require('vue-loader/lib/plugin'))
|
|
26
|
+
function makeWebpackConfig({ packageName, entry, externals, debug, minifier }) {
|
|
27
|
+
const externalsRegex = makeExternalsRegex(externals.externalPackages)
|
|
28
|
+
const isExternalRequest = request => {
|
|
29
|
+
const isPeerDep = externals.externalPackages.length
|
|
30
|
+
? externalsRegex.test(request)
|
|
31
|
+
: false
|
|
32
|
+
const isBuiltIn = externals.externalBuiltIns.includes(request)
|
|
33
|
+
return isPeerDep || isBuiltIn
|
|
34
|
+
}
|
|
35
|
+
log('external packages %o', externalsRegex)
|
|
36
|
+
const builtInNode = {}
|
|
37
|
+
builtin_modules_1.default.forEach(mod => {
|
|
38
|
+
builtInNode[mod] = 'empty'
|
|
39
|
+
})
|
|
40
|
+
builtInNode['setImmediate'] = false
|
|
41
|
+
builtInNode['console'] = false
|
|
42
|
+
builtInNode['process'] = false
|
|
43
|
+
builtInNode['Buffer'] = false
|
|
44
|
+
// Don't mark an import as built in if it is the name of the package itself
|
|
45
|
+
// eg. `events`
|
|
46
|
+
if (builtInNode[packageName]) {
|
|
47
|
+
builtInNode[packageName] = false
|
|
48
|
+
}
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
return {
|
|
53
|
+
entry: entry,
|
|
54
|
+
mode: 'production',
|
|
55
|
+
// bail: true,
|
|
56
|
+
optimization: {
|
|
57
|
+
namedChunks: true,
|
|
58
|
+
runtimeChunk: { name: 'runtime' },
|
|
59
|
+
minimize: true,
|
|
60
|
+
splitChunks: {
|
|
61
|
+
cacheGroups: {
|
|
62
|
+
styles: {
|
|
63
|
+
name: 'main',
|
|
64
|
+
test: /\.css$/,
|
|
65
|
+
chunks: 'all',
|
|
66
|
+
enforce: true,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
// @ts-ignore: Appears that the library CssoWebpackPlugin might have incorrect definitions
|
|
71
|
+
minimizer: [
|
|
72
|
+
...(minifier === 'terser'
|
|
73
|
+
? [
|
|
74
|
+
new terser_webpack_plugin_1.default({
|
|
75
|
+
parallel: true,
|
|
76
|
+
terserOptions: {
|
|
77
|
+
ie8: false,
|
|
78
|
+
output: {
|
|
79
|
+
comments: false,
|
|
80
|
+
},
|
|
60
81
|
},
|
|
82
|
+
}),
|
|
83
|
+
]
|
|
84
|
+
: [
|
|
85
|
+
new esbuild_loader_1.ESBuildMinifyPlugin({
|
|
86
|
+
target: 'esnext',
|
|
87
|
+
}),
|
|
88
|
+
]),
|
|
89
|
+
new csso_webpack_plugin_1.default({ restructure: false }),
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
plugins: [
|
|
93
|
+
new webpack_1.default.IgnorePlugin(/^electron$/),
|
|
94
|
+
new plugin_1.default(),
|
|
95
|
+
new mini_css_extract_plugin_1.default({
|
|
96
|
+
// Options similar to the same options in webpackOptions.output
|
|
97
|
+
// both options are optional
|
|
98
|
+
filename: '[name].bundle.css',
|
|
99
|
+
chunkFilename: '[id].bundle.css',
|
|
100
|
+
}),
|
|
101
|
+
...(debug ? [new write_file_webpack_plugin_1.default()] : []),
|
|
102
|
+
],
|
|
103
|
+
resolve: {
|
|
104
|
+
modules: ['node_modules'],
|
|
105
|
+
cacheWithContext: false,
|
|
106
|
+
extensions: [
|
|
107
|
+
'.web.mjs',
|
|
108
|
+
'.mjs',
|
|
109
|
+
'.web.js',
|
|
110
|
+
'.js',
|
|
111
|
+
'.mjs',
|
|
112
|
+
'.json',
|
|
113
|
+
'.css',
|
|
114
|
+
'.sass',
|
|
115
|
+
'.scss',
|
|
116
|
+
],
|
|
117
|
+
mainFields: ['browser', 'module', 'main', 'style'],
|
|
118
|
+
},
|
|
119
|
+
module: {
|
|
120
|
+
rules: [
|
|
121
|
+
{
|
|
122
|
+
test: /\.css$/,
|
|
123
|
+
use: [
|
|
124
|
+
mini_css_extract_plugin_1.default.loader,
|
|
125
|
+
require.resolve('css-loader'),
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
// see https://github.com/apollographql/react-apollo/issues/1737
|
|
129
|
+
{
|
|
130
|
+
type: 'javascript/auto',
|
|
131
|
+
test: /\.mjs$/,
|
|
132
|
+
use: [],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
test: /\.js$/,
|
|
136
|
+
loader: [
|
|
137
|
+
// support CLI tools that start with a #!/usr/bin/node
|
|
138
|
+
require.resolve('shebang-loader'),
|
|
139
|
+
// ESBuild Minifier doesn't auto-remove license comments from code
|
|
140
|
+
// So, we break ESBuild's heuristic for license comments match. See github.com/privatenumber/esbuild-loader/issues/87
|
|
141
|
+
{
|
|
142
|
+
loader: require.resolve('string-replace-loader'),
|
|
143
|
+
options: {
|
|
144
|
+
multiple: [
|
|
145
|
+
{ search: '@license', replace: '@silence' },
|
|
146
|
+
{ search: /\/\/!/g, replace: '//' },
|
|
147
|
+
{ search: /\/\*!/g, replace: '/*' },
|
|
148
|
+
],
|
|
149
|
+
},
|
|
61
150
|
},
|
|
62
|
-
|
|
63
|
-
minimizer: [
|
|
64
|
-
...(minifier === 'terser'
|
|
65
|
-
? [
|
|
66
|
-
new terser_webpack_plugin_1.default({
|
|
67
|
-
parallel: true,
|
|
68
|
-
terserOptions: {
|
|
69
|
-
ie8: false,
|
|
70
|
-
output: {
|
|
71
|
-
comments: false,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
}),
|
|
75
|
-
]
|
|
76
|
-
: [
|
|
77
|
-
new esbuild_loader_1.ESBuildMinifyPlugin({
|
|
78
|
-
target: 'esnext',
|
|
79
|
-
}),
|
|
80
|
-
]),
|
|
81
|
-
new csso_webpack_plugin_1.default({ restructure: false }),
|
|
82
|
-
],
|
|
151
|
+
],
|
|
83
152
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}),
|
|
93
|
-
...(debug ? [new write_file_webpack_plugin_1.default()] : []),
|
|
94
|
-
],
|
|
95
|
-
resolve: {
|
|
96
|
-
modules: ['node_modules'],
|
|
97
|
-
cacheWithContext: false,
|
|
98
|
-
extensions: [
|
|
99
|
-
'.web.mjs',
|
|
100
|
-
'.mjs',
|
|
101
|
-
'.web.js',
|
|
102
|
-
'.js',
|
|
103
|
-
'.mjs',
|
|
104
|
-
'.json',
|
|
105
|
-
'.css',
|
|
106
|
-
'.sass',
|
|
107
|
-
'.scss',
|
|
108
|
-
],
|
|
109
|
-
mainFields: ['browser', 'module', 'main', 'style'],
|
|
153
|
+
{
|
|
154
|
+
test: /\.(html|svelte)$/,
|
|
155
|
+
use: {
|
|
156
|
+
loader: require.resolve('svelte-loader'),
|
|
157
|
+
options: {
|
|
158
|
+
emitCss: true,
|
|
159
|
+
},
|
|
160
|
+
},
|
|
110
161
|
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
loader: require.resolve('svelte-loader'),
|
|
146
|
-
options: {
|
|
147
|
-
emitCss: true,
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
test: /\.vue$/,
|
|
153
|
-
loader: require.resolve('vue-loader'),
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
test: /\.(scss|sass)$/,
|
|
157
|
-
loader: [
|
|
158
|
-
mini_css_extract_plugin_1.default.loader,
|
|
159
|
-
require.resolve('css-loader'),
|
|
160
|
-
{
|
|
161
|
-
loader: require.resolve('postcss-loader'),
|
|
162
|
-
options: {
|
|
163
|
-
plugins: () => [autoprefixer_1.default()],
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
require.resolve('sass-loader'),
|
|
167
|
-
],
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
test: /\.less$/,
|
|
171
|
-
loader: [
|
|
172
|
-
mini_css_extract_plugin_1.default.loader,
|
|
173
|
-
require.resolve('css-loader'),
|
|
174
|
-
{
|
|
175
|
-
loader: require.resolve('postcss-loader'),
|
|
176
|
-
options: {
|
|
177
|
-
plugins: () => [
|
|
178
|
-
autoprefixer_1.default({
|
|
179
|
-
browsers: [
|
|
180
|
-
'last 5 Chrome versions',
|
|
181
|
-
'last 5 Firefox versions',
|
|
182
|
-
'Safari >= 8',
|
|
183
|
-
'Explorer >= 10',
|
|
184
|
-
'edge >= 12',
|
|
185
|
-
],
|
|
186
|
-
}),
|
|
187
|
-
],
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
loader: require.resolve('less-loader'),
|
|
192
|
-
options: {
|
|
193
|
-
webpackImporter: true,
|
|
194
|
-
},
|
|
195
|
-
},
|
|
162
|
+
{
|
|
163
|
+
test: /\.vue$/,
|
|
164
|
+
loader: require.resolve('vue-loader'),
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
test: /\.(scss|sass)$/,
|
|
168
|
+
loader: [
|
|
169
|
+
mini_css_extract_plugin_1.default.loader,
|
|
170
|
+
require.resolve('css-loader'),
|
|
171
|
+
{
|
|
172
|
+
loader: require.resolve('postcss-loader'),
|
|
173
|
+
options: {
|
|
174
|
+
plugins: () => [autoprefixer_1.default()],
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
require.resolve('sass-loader'),
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
test: /\.less$/,
|
|
182
|
+
loader: [
|
|
183
|
+
mini_css_extract_plugin_1.default.loader,
|
|
184
|
+
require.resolve('css-loader'),
|
|
185
|
+
{
|
|
186
|
+
loader: require.resolve('postcss-loader'),
|
|
187
|
+
options: {
|
|
188
|
+
plugins: () => [
|
|
189
|
+
autoprefixer_1.default({
|
|
190
|
+
browsers: [
|
|
191
|
+
'last 5 Chrome versions',
|
|
192
|
+
'last 5 Firefox versions',
|
|
193
|
+
'Safari >= 8',
|
|
194
|
+
'Explorer >= 10',
|
|
195
|
+
'edge >= 12',
|
|
196
196
|
],
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
197
|
+
}),
|
|
198
|
+
],
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
loader: require.resolve('less-loader'),
|
|
203
|
+
options: {
|
|
204
|
+
webpackImporter: true,
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
],
|
|
207
208
|
},
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
{
|
|
210
|
+
test: /\.(woff|woff2|eot|ttf|svg|png|jpeg|jpg|gif|webp)$/,
|
|
211
|
+
loader: require.resolve('file-loader'),
|
|
212
|
+
options: {
|
|
213
|
+
name: '[name].bundle.[ext]',
|
|
214
|
+
emitFile: true,
|
|
215
|
+
},
|
|
212
216
|
},
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
node: builtInNode,
|
|
220
|
+
output: {
|
|
221
|
+
filename: 'bundle.js',
|
|
222
|
+
pathinfo: false,
|
|
223
|
+
},
|
|
224
|
+
externals: (context, request, callback) =>
|
|
225
|
+
isExternalRequest(request)
|
|
226
|
+
? callback(null, 'commonjs ' + request)
|
|
227
|
+
: callback(),
|
|
228
|
+
}
|
|
217
229
|
}
|
|
218
|
-
exports.default = makeWebpackConfig
|
|
230
|
+
exports.default = makeWebpackConfig
|
|
219
231
|
function makeExternalsRegex(externals) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
232
|
+
let externalsRegex = externals
|
|
233
|
+
.map(
|
|
234
|
+
dep =>
|
|
235
|
+
`^${escape_string_regexp_1.default(
|
|
236
|
+
dep
|
|
237
|
+
)}$|^${escape_string_regexp_1.default(dep)}\\/`
|
|
238
|
+
)
|
|
239
|
+
.join('|')
|
|
240
|
+
externalsRegex = `(${externalsRegex})`
|
|
241
|
+
return new RegExp(externalsRegex)
|
|
225
242
|
}
|