【问题标题】:Parcel is not creating a dist folder when I use build command当我使用 build 命令时,Parcel 没有创建 dist 文件夹
【发布时间】:2021-08-21 06:27:42
【问题描述】:

我在使用 Tailwind CSS 和 Parcel 作为捆绑器构建网站时遇到了困难。当我使用npm start 命令时,它会创建一个dist 文件夹并将其服务到本地主机,端口:1234。但是当我使用npm build 命令时,它不会创建dist 文件夹而是在根文件夹中构建。顺便说一下,我了解了来自here 的命令。这是我的package.json

{
  "name": "my-website",
  "version": "1.0.0",
  "description": "Empty project.",
  "main": "index.html",
  "scripts": {
    "start": "parcel serve ./src/index.html",
    "build": "parcel build ./src/index.html"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/Surayani02/my-website.git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/Surayani02/my-website/issues"
  },
  "homepage": "https://github.com/Surayani02/my-website#readme",
  "devDependencies": {
    "autoprefixer": "^10.2.5",
    "parcel": "^2.0.0-beta.3.1",
    "postcss": "^8.2.13",
    "tailwindcss": "^2.1.2"
  },
  "dependencies": {
    "@tailwindcss/forms": "^0.3.2"
  }
}

【问题讨论】:

    标签: bundler tailwind-css parceljs


    【解决方案1】:

    "build:prod": "parcel build index.html --dist-dir ./dist"

    试试这个命令

    将“main”替换为“default” “默认”:“index.html”,

    那就试试吧

    【讨论】:

    • 请在您的回答中提供更多详细信息。正如目前所写的那样,很难理解您的解决方案。
    【解决方案2】:

    尝试卸载“autoprefixer”和“postcss”包,因为我相信它们已经包含在 ParcelJS 中。

    然后尝试在控制台中运行“parcel ./src/index.html”,看看它是否有效。

    【讨论】:

      猜你喜欢
      • 2020-03-22
      • 1970-01-01
      • 1970-01-01
      • 2019-04-06
      • 2014-01-10
      • 2022-06-28
      • 2017-11-12
      • 2019-04-06
      • 1970-01-01
      相关资源
      最近更新 更多