From e2c18e6338c3106c086911f294af11d471461862 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Mon, 1 Oct 2018 18:35:30 -0500 Subject: [PATCH] default webpack-overrides.js --- lib/pipeline/webpack-overrides.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 lib/pipeline/webpack-overrides.js diff --git a/lib/pipeline/webpack-overrides.js b/lib/pipeline/webpack-overrides.js new file mode 100644 index 00000000..de4fa62a --- /dev/null +++ b/lib/pipeline/webpack-overrides.js @@ -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; + } + }; +};