首先,我是新手。我对Jekyll、Lando、Drupal、WordPress、basic Git、HTML5/CSS3并不陌生。我对JS不感兴趣。好吧,那不碍事。
我有一个简单的单页网站(splash page)将演变成一个多页网站。我决定试试盖茨比。这个
gatsby develop
命令运行良好,对于未使用的变量等,我没有es lint错误。这个
gatsby build
命令会产生一个看起来像超级基本的错误。这个网站只有两页404页和一个索引。如果删除404页,索引页上也会出现同样的错误。盖茨比/Webpack似乎对传递的第一条内容感到窒息:
JHogue:civicpolicy jhogue$ gatsby build
success open and validate gatsby-configs â 0.006 s
success load plugins â 0.131 s
success onPreInit â 0.166 s
success delete html and css files from previous builds â 0.008 s
success initialize cache â 0.006 s
success copy gatsby files â 0.068 s
success onPreBootstrap â 0.006 s
success source and transform nodes â 0.048 s
success building schema â 0.154 s
success createPages â 0.000 s
success createPagesStatefully â 0.024 s
success onPreExtractQueries â 0.000 s
success update schema â 0.085 s
success extract queries from components â 0.050 s
success run graphql queries â 0.022 s â 4/4 197.54 queries/second
success write out page data â 0.003 s
success write out redirect data â 0.001 s
success onPostBootstrap â 0.001 s
info bootstrap finished - 3.259 s
error Generating JavaScript bundles failed
Error: ./.cache/async-requires.js 8:11
Module parse failed: Unexpected token (8:11)
You may need an appropriate loader to handle this file type.
| exports.components = {
| "component---src-pages-404-js": function componentSrcPages404Js() {
> return import("/Users/jhogue/github/civicpolicy/src/pages/404.js"
| /* webpackChunkName: "component---src-pages-404-js" */
| );
@ ./.cache/production-app.js 18:0-45 21:23-36 26:23-36
因为它只是一个启动页,所以没有数据源,没有标记文件,没有要迭代的页面数组。很简单。
我的依赖项列表如下:
"dependencies": {
"css-mqpacker": "^7.0.0",
"gatsby": "^2.0.117",
"gatsby-cli": "^2.4.9",
"gatsby-plugin-react-helmet": "^3.0.6",
"gatsby-plugin-sass": "^2.0.10",
"gatsby-source-filesystem": "^2.0.20",
"gatsby-transformer-json": "^2.1.8",
"gatsby-transformer-remark": "^2.2.4",
"node-sass": "^4.11.0",
"react": "^16.8.1",
"react-dom": "^16.8.1",
"react-helmet": "^5.2.0"
},
"devDependencies": {
"babel-eslint": "^9.0.0",
"eslint": "^5.13.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-prettier": "^2.0.1",
"eslint-plugin-react": "^7.12.4",
"prettier-eslint": "^8.8.2"
}
任何指点都将不胜感激。谢谢。