From 53118e1afae9827d516d628470d25726af603a75 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Wed, 19 Jun 2019 08:02:49 +1000 Subject: [PATCH] Add alias for react-spring in webpack config (#16196) * Add alias for react-spring in webpack config * Add explanatory comment. * Move to direct imports and linting rule. --- .eslintrc.js | 4 ++++ packages/components/src/snackbar/list.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 464b6e57cf3eb..64ce20d480d39 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -33,6 +33,10 @@ module.exports = { selector: 'ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]', message: 'Path access on WordPress dependencies is not allowed.', }, + { + selector: 'ImportDeclaration[source.value=/^react-spring(?!\\u002Fweb\.cjs)/]', + message: 'The react-spring dependency must specify CommonJS bundle: react-spring/web.cjs', + }, { selector: 'CallExpression[callee.name="deprecated"] Property[key.name="version"][value.value=/' + majorMinorRegExp + '/]', message: 'Deprecated functions must be removed before releasing this version.', diff --git a/packages/components/src/snackbar/list.js b/packages/components/src/snackbar/list.js index b44aa8d24c93a..ca9060560ad0a 100644 --- a/packages/components/src/snackbar/list.js +++ b/packages/components/src/snackbar/list.js @@ -3,7 +3,7 @@ */ import classnames from 'classnames'; import { omit, noop } from 'lodash'; -import { useTransition, animated } from 'react-spring'; +import { useTransition, animated } from 'react-spring/web.cjs'; /** * WordPress dependencies