Skip to content

Commit 2fcbd31

Browse files
Peter Bengtssonianschmitz
Peter Bengtsson
authored andcommitted
Add environment variable to control image inlining threshold (facebook#6060)
Fixes facebook#3437
1 parent c195cad commit 2fcbd31

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

config/webpack.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
4444
// makes for a smoother build process.
4545
const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
4646

47+
const imageInlineSizeLimit = parseInt(
48+
process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
49+
);
50+
4751
// Check if TypeScript is setup
4852
const useTypeScript = fs.existsSync(paths.appTsConfig);
4953

@@ -343,7 +347,7 @@ module.exports = function(webpackEnv) {
343347
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
344348
loader: require.resolve('url-loader'),
345349
options: {
346-
limit: 10000,
350+
limit: imageInlineSizeLimit,
347351
name: 'static/media/[name].[hash:8].[ext]',
348352
},
349353
},

0 commit comments

Comments
 (0)