Add environment variable to control image inlining threshold (#6060)

Fixes #3437
This commit is contained in:
Peter Bengtsson
2019-06-18 00:25:40 -04:00
committed by Ian Schmitz
parent 45197e67fd
commit 9d70c7afab
3 changed files with 7 additions and 2 deletions

View File

@@ -44,6 +44,10 @@ const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
// makes for a smoother build process.
const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
const imageInlineSizeLimit = parseInt(
process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
);
// Check if TypeScript is setup
const useTypeScript = fs.existsSync(paths.appTsConfig);
@@ -343,7 +347,7 @@ module.exports = function(webpackEnv) {
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
loader: require.resolve('url-loader'),
options: {
limit: 10000,
limit: imageInlineSizeLimit,
name: 'static/media/[name].[hash:8].[ext]',
},
},