Do not minify bundle.lib

This commit is contained in:
Roman Hotsiy 2017-11-20 00:59:28 +02:00
parent adfc5e58c5
commit 64471c649a
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 11 additions and 6 deletions

View File

@ -17,7 +17,7 @@
"cy:open": "cypress open", "cy:open": "cypress open",
"bundle:clean": "rimraf bundles", "bundle:clean": "rimraf bundles",
"bundle:standalone": "webpack -p --env.lib --env.standalone --env.prod", "bundle:standalone": "webpack -p --env.lib --env.standalone --env.prod",
"bundle:lib": "webpack -p --env.lib --env.prod", "bundle:lib": "webpack --env.lib",
"bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:standalone", "bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:standalone",
"stats": "webpack -p --env.lib --env.standalone --env.prod --json --profile > stats.json", "stats": "webpack -p --env.lib --env.standalone --env.prod --json --profile > stats.json",
"prettier": "prettier --write \"src/**/*.{ts,tsx}\"" "prettier": "prettier --write \"src/**/*.{ts,tsx}\""

View File

@ -1,6 +1,10 @@
import * as webpack from 'webpack'; import * as webpack from 'webpack';
import * as HtmlWebpackPlugin from 'html-webpack-plugin'; import * as HtmlWebpackPlugin from 'html-webpack-plugin';
import * as nodeExternals from 'webpack-node-externals';
const nodeExternals = require('webpack-node-externals')({
// bundle in moudules that need transpiling + non-js (e.g. css)
whitelist: ['swagger2openapi', 'reftools', /\.(?!(?:jsx?|json)$).{1,5}$/i],
});
export default env => { export default env => {
env = env || {}; env = env || {};
@ -105,10 +109,11 @@ export default env => {
config.output!.libraryTarget = 'umd'; config.output!.libraryTarget = 'umd';
if (!env.standalone) { if (!env.standalone) {
config.externals = nodeExternals({ config.externals = (context, request, callback) => {
// bundle in moudules that need transpiling + non-js (e.g. css) // ignore node-fetch dep of swagger2openapi as it is not used
whitelist: ['swagger2openapi', 'reftools', /\.(?!(?:jsx?|json)$).{1,5}$/i], if (/node-fetch$/i.test(request)) return callback(null, 'var fetch');
}); return nodeExternals(context, request, callback);
};
} }
} else { } else {
config.plugins!.push( config.plugins!.push(