首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >模块解析在下一个js零配置中失败

模块解析在下一个js零配置中失败
EN

Stack Overflow用户
提问于 2019-04-23 22:21:44
回答 1查看 1.2K关注 0票数 1

接下来,它似乎没有处理转换,但根据文档,它应该转换所有的react组件。

代码语言:javascript
复制
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>

The package.json

代码语言:javascript
复制
{
  "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"
  }
}

这是应该呈现的组件。

代码语言:javascript
复制
// dummy component under /pages

import React from 'react';

export default () => {
  return (
    <div>
      <p>Hi</p>
    </div>
  );
};

它应该根据文档呈现一个虚拟页面。

EN

回答 1

Stack Overflow用户

发布于 2019-04-26 04:29:45

解决了。

这是我的用户文件夹中的环境问题。这是一个全局的babel设置,它只会干扰nextjs包,删除包含该存储信息的目录就足够了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55813386

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档