Open
Description
Hi,
I use rc-tween-one with latest version of nextjs ("next": "12.0.7",) and get the compile error:
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:988:16)
at Module._compile (internal/modules/cjs/loader.js:1036:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/path/to/my-proj/node_modules/rc-tween-one/lib/plugin/PathMotionPlugin.js:10:48)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
error - SyntaxError: Cannot use import statement outside a module
/path/to/my-proj/node_modules/tween-one/es/plugins/PathMotionPlugin.js:1
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
^^^^^^
FYI, next@12 use swc instead of babel
Reproduction steps
- Create new next app
yarn create next-app --typescript
yarn add rc-tween-one
- Use rc-tween-one:
pages/_app.tsx
import '../styles/globals.css'
import type { AppProps } from 'next/app'
// ----> Add this line
import TweenOne from 'rc-tween-one';
function MyApp({ Component, pageProps }: AppProps) {
// ----> Add this code
return (
<TweenOne
animation={{
x: 80,
scale: 0.5,
rotate: 120,
yoyo: true, // demo 演示需要
repeat: -1, // demo 演示需要
duration: 1000
}}
paused={false}
style={{ transform: 'translateX(-80px)' }}
className="code-box-shape"
/>
)
}
export default MyApp
Expected behavior
Can compile and run it
Thanks
Metadata
Metadata
Assignees
Labels
No labels