mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-27 04:40:43 +00:00
default webpack-overrides.js
This commit is contained in:
parent
c8f1add82c
commit
8db316ebf0
29
lib/pipeline/webpack-overrides.js
Normal file
29
lib/pipeline/webpack-overrides.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
* This source code was adapted from:
|
||||||
|
* https://github.com/facebook/create-react-app/blob/72d4ab02922c54b80126da2e132f60fdbdc2f6b3/packages/babel-preset-react-app/webpack-overrides.js
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-present, Facebook, Inc.
|
||||||
|
*
|
||||||
|
* The MIT license for this code may be found on GitHub:
|
||||||
|
* https://github.com/facebook/create-react-app/blob/72d4ab02922c54b80126da2e132f60fdbdc2f6b3/LICENSE
|
||||||
|
*/
|
||||||
|
|
||||||
|
const crypto = require('crypto');
|
||||||
|
const macroCheck = new RegExp('[./]macro');
|
||||||
|
|
||||||
|
module.exports = function () {
|
||||||
|
return {
|
||||||
|
config(config, {source}) {
|
||||||
|
// don't cache babel macros
|
||||||
|
// https://github.com/babel/babel/issues/8497
|
||||||
|
if (macroCheck.test(source)) {
|
||||||
|
return Object.assign({}, config.options, {
|
||||||
|
caller: Object.assign({}, config.options.caller, {
|
||||||
|
macroInvalidationToken: crypto.randomBytes(32).toString('hex')
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return config.options;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user