【问题标题】:Parcel Bundler: Everything is okay on localhost but The index.html on Dist is showing ErrorParcel Bundler:本地主机上一切正常,但 Dist 上的 index.html 显示错误
【发布时间】:2020-11-02 22:22:08
【问题描述】:

我正在学习 Parcel,并尝试捆绑一个与 index.js 连接的 index.htmllocalhost:1234 包裹上一切正常,但在 dist 文件夹中,当我打开 index.html 时,应用程序无法正常工作。

注意:我知道问题是由于在我的 index.js 中使用 import 引起的

我的 package.json 文件 -

{
  "name": "reddit",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.10.4",
    "cssnano": "^4.1.10"
  },
  "description": ""
}

My index.html code for script connect

My all folders list

importing redditapi.js in index.js(check the all folder list image)

The error I am getting when I try to use the APP on index.html from dist folder

【问题讨论】:

    标签: javascript npm babeljs node-modules parceljs


    【解决方案1】:

    问题已解决。导入不应包括来自。它应该是 import 'index';谢谢你。在我的 NPM 运行构建命令之后,一切都得到了修复。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-29
      • 1970-01-01
      • 2019-11-09
      • 1970-01-01
      • 2018-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多