mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 16:46:34 +03:00
chore: ignore some not-used code from node_modules (-9KB)
This commit is contained in:
parent
c3c46e1713
commit
39352e6e4a
|
@ -78,6 +78,11 @@ export default (env: { playground?: boolean; bench?: boolean } = {}, { mode }) =
|
||||||
|
|
||||||
performance: false,
|
performance: false,
|
||||||
|
|
||||||
|
externals: {
|
||||||
|
esprima: 'esprima',
|
||||||
|
'node-fetch': 'null',
|
||||||
|
},
|
||||||
|
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{ enforce: 'pre', test: /\.js$/, loader: 'source-map-loader' },
|
{ enforce: 'pre', test: /\.js$/, loader: 'source-map-loader' },
|
||||||
|
@ -123,6 +128,12 @@ export default (env: { playground?: boolean; bench?: boolean } = {}, { mode }) =
|
||||||
template: env.playground ? 'demo/playground/index.html' : 'demo/index.html',
|
template: env.playground ? 'demo/playground/index.html' : 'demo/index.html',
|
||||||
}),
|
}),
|
||||||
new ForkTsCheckerWebpackPlugin(),
|
new ForkTsCheckerWebpackPlugin(),
|
||||||
|
ignore(/js-yaml\/dumper\.js$/),
|
||||||
|
ignore(/json-schema-ref-parser\/lib\/dereference\.js/),
|
||||||
new CopyWebpackPlugin(['demo/openapi.yaml']),
|
new CopyWebpackPlugin(['demo/openapi.yaml']),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function ignore(regexp) {
|
||||||
|
return new webpack.NormalModuleReplacementPlugin(regexp, require.resolve('lodash/noop.js'));
|
||||||
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ export default (env: { standalone?: boolean } = {}, { mode }) => ({
|
||||||
: (context, request, callback) => {
|
: (context, request, callback) => {
|
||||||
// ignore node-fetch dep of swagger2openapi as it is not used
|
// ignore node-fetch dep of swagger2openapi as it is not used
|
||||||
if (/node-fetch$/i.test(request)) return callback(null, 'var undefined');
|
if (/node-fetch$/i.test(request)) return callback(null, 'var undefined');
|
||||||
|
if (/esprima$/i.test(request)) return callback(null, 'var undefined');
|
||||||
return nodeExternals(context, request, callback);
|
return nodeExternals(context, request, callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -124,5 +125,11 @@ export default (env: { standalone?: boolean } = {}, { mode }) => ({
|
||||||
}),
|
}),
|
||||||
new ForkTsCheckerWebpackPlugin({ silent: true }),
|
new ForkTsCheckerWebpackPlugin({ silent: true }),
|
||||||
new webpack.BannerPlugin(BANNER),
|
new webpack.BannerPlugin(BANNER),
|
||||||
|
ignore(/js-yaml\/dumper\.js$/),
|
||||||
|
ignore(/json-schema-ref-parser\/lib\/dereference\.js/),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function ignore(regexp) {
|
||||||
|
return new webpack.NormalModuleReplacementPlugin(regexp, require.resolve('lodash/noop.js'));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user