arco-design-mobile
arco-design-mobile copied to clipboard
使用next.js并按照文档使用部分引入,则会报错Syntax error: Unexpected token > 1 | import type { AppProps } from 'next/app'
- [ ] I'm sure this does not appear in the issue list of the repository
Basic Info
- Package Name And Version: @arco-design/[email protected]
- Phone Model And Version: 17621703478
Steps to reproduce
设置 .babelrc.js:module.exports = function (api) { api.cache(true);
const presets = ["next/babel", "@babel/preset-typescript"];
const plugins = [
["import", {
"libraryName": "@arco-design/mobile-react/esm/icon", // 注意如果是 SSR 环境,这里需将 `esm` 替换为 `cjs`
"libraryDirectory": "",
"camel2DashComponentName": false,
}]
];
return {
presets,
plugins
};
}
tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"strict": false,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": "./src",
"paths": {
"@/": ["./"]
},
"rootDirs": ["common/src/", "arco-design-pro-cra/src/", "arco-design-pro-next/src/"]
},
"include": ["/*.ts", "/*.tsx"],
"exclude": ["node_modules"]
}