| 141 | ]; |
| 142 | |
| 143 | function getBabelConfig( |
| 144 | updateBabelOptions, |
| 145 | bundleType, |
| 146 | packageName, |
| 147 | isDevelopment, |
| 148 | bundle |
| 149 | ) { |
| 150 | let options = { |
| 151 | exclude: '/**/node_modules/**', |
| 152 | babelrc: false, |
| 153 | configFile: false, |
| 154 | presets: [], |
| 155 | plugins: [...babelPlugins], |
| 156 | babelHelpers: 'bundled', |
| 157 | sourcemap: false, |
| 158 | }; |
| 159 | if (isDevelopment) { |
| 160 | options.plugins.push(...babelToES5Plugins); |
| 161 | } |
| 162 | if (updateBabelOptions) { |
| 163 | options = updateBabelOptions(options); |
| 164 | } |
| 165 | // Controls whether to replace error messages with error codes in production. |
| 166 | // By default, error messages are replaced in production. |
| 167 | if (!isDevelopment && bundle.minifyWithProdErrorCodes !== false) { |
| 168 | options.plugins.push(require('../error-codes/transform-error-messages')); |
| 169 | } |
| 170 | |
| 171 | return options; |
| 172 | } |
| 173 | |
| 174 | let getRollupInteropValue = id => { |
| 175 | // We're setting Rollup to assume that imports are ES modules unless otherwise specified. |