【问题标题】:Unexpected token m in JSON at position 0 for cloud 9.io云 9.io 位置 0 处 JSON 中的意外令牌 m
【发布时间】:2018-11-08 17:25:18
【问题描述】:

我是编码新手,我正在尝试做讲师正在做的事情。我们正在研究 webpacks 但每次我尝试使用它提出的命令“npx webpack” /home/ubuntu/workspace/assignment1/hellowp/webpack.config.json:JSON 中位置 0 处的意外标记 m"

我该如何解决这个问题?

module.exports = {
    entry: './src/app.js',
        output: {
        filename: 'app.bundle.js',
    path: __dirname + '/dist'
    }
};

package.json:

{
  "name": "hellowp",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "webpack": "^4.10.1",
    "webpack-cli": "^2.1.4"
  },
  "dependencies": {
    "jquery": "^3.3.1"
  }
}

app.js

import $ from "jquery";

$(document).ready(function(){
    $('#intro').html("Hello Webpack");
})

  <div id = 'intro'></p>
  <script src='./dist/app.bundle.js'></script>
  
  //whats in my html

【问题讨论】:

    标签: javascript jquery css json syntax


    【解决方案1】:

    将文件名更改为 webpack.config.js(不是 .json)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-01
      • 2016-12-13
      • 1970-01-01
      • 2018-06-10
      • 1970-01-01
      • 1970-01-01
      • 2021-09-21
      • 2021-07-11
      相关资源
      最近更新 更多