Files
polaris-react/babel.config.js
Ben Scott 0edecb7697 Update to latest sewing-kit
Update a few dependencies that we want to keep in sync with sewing-kit

Use `sewing-kit optimize` to optimize svgs instead of maintaining our
own script which does the same thing.
2019-05-08 11:26:14 +02:00

18 lines
681 B
JavaScript

module.exports = function(api) {
// When building (using rollup) or running storybook (using babel-loader) we
// want to compile for the web otherwise compile for node usage (within jest)
const isWeb = api.caller((caller = {}) => {
return ['babel-loader', 'rollup-plugin-babel'].includes(caller.name);
});
const runtimePreset = isWeb
? ['babel-preset-shopify/web', {modules: false, useBuiltIns: 'entry'}]
: ['babel-preset-shopify/node', {modules: 'commonjs'}];
// babel-preset-shopify/react only uses HMR if hot is true and the env is
// development or test
return {
presets: [runtimePreset, ['babel-preset-shopify/react', {hot: isWeb}]],
};
};