【发布时间】:2019-08-20 01:51:45
【问题描述】:
我想在 amplify 中运行 'npm build'(nuxt build) 后创建 dist 文件夹。
我在我的 local(mac) 中运行 npm build,然后创建 dist 文件夹。
我在 'npm build' 之后运行 'ls -a' ,然后 dist 文件夹在 amplify 中不存在。
> nuxt build
2019-08-20T01:49:08.598Z [INFO]: # Executing command: ls -a
2019-08-20T01:49:08.602Z [INFO]: .
..
amplify.sh
amplify.yml
assets
components
.editorconfig
.eslintrc.js
.git
.gitignore
layouts
middleware
node_modules
.nuxt
nuxt.config.js
package.json
package-lock.json
pages
plugins
.prettierrc
README.md
static
store
.vscode
yarn.lock
# Completed phase: build
这里是 package.json
{
...
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"precommit": "npm run lint"
},
这里是 amplify.yml
version: 0.1
frontend:
phases:
preBuild:
commands:
- npm install
build:
commands:
- npm run build
- ls -a
artifacts:
# IMPORTANT - Please verify your build output directory
baseDirectory:
dist
files:
- '**/*'
cache:
paths:
- node_modules/**/*
等待您的答复,谢谢。
【问题讨论】:
-
这是真的。你有
.nuxt代替。您将利用它来构建您的应用程序。 -
@Ohgodwhy 感谢您的回复。但据我了解,.nuxt 用于 SSR。这是错的吗?我尝试使用 .nuxt/dist/server/index.spa.html ,但效果不佳。
-
因为所有
.js和.css文件的路径都不正确,所以不能正常工作。您需要根据 Web 服务器期望提供的内容来映射它们。 -
我试过'npm run generate',但它没有创建dist文件夹..
-
@Ohgodwhy 我 google 'nuxt codebuild' 等等,但我找不到使用 .nuxt 文件夹的教程或答案,我只能找到使用 'dist' 文件夹的方法。你知道一些好的教程或代码来使用 .nuxt 吗?
标签: vue.js single-page-application nuxt.js aws-amplify aws-codebuild