mirror of
https://github.com/HackPlan/polaris-react.git
synced 2026-01-12 22:44:36 +08:00
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.
18 lines
681 B
JavaScript
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}]],
|
|
};
|
|
};
|