下一步,似乎不处理转译,但根据文档,它应该转译所有反应组分。
yarn run v1.15.2
$ next
[ wait ] starting the development server ...
[ info ] waiting on http://localhost:3000 ...
[ ready ] compiled successfully
[ info ] ready on http://localhost:3000
[ event ] client pings, but there's no entry for page: /_error
[ event ] build page: /
[ wait ] compiling ...
[ error ] C:/Users/danie/Documents/Projects/next-step/pages/index.js 5:4
Module parse failed: Unexpected token (5:4)
You may need an appropriate loader to handle this file type.
| export default () => {
| return (
> <div>
| <p>Ciao</p>
| </div>
[ event ] build page: /next/dist/pages/_error
[ wait ] compiling ...
[ error ] C:/Users/danie/Documents/Projects/next-step/pages/index.js 5:4
Module parse failed: Unexpected token (5:4)
You may need an appropriate loader to handle this file type.
| export default () => {
| return (
> <div>
| <p>Ciao</p>
| </div>
package.json
{
"name": "next-step",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^8.1.0",
"react": "^16.8.6",
"react-dom": "^16.8.6"
}
}
这是应该渲染的组件。
// dummy component under /pages
import React from 'react';
export default () => {
return (
<div>
<p>Hi</p>
</div>
);
};
它应该根据文档呈现一个虚拟页面。
答案 0 :(得分:0)
已解决。
这是我的用户文件夹中的环境问题。 这是一个全局babel设置,仅会干扰nextjs软件包,并且删除具有存储信息的目录就足够了。