如何创建 EmberJS 应用程序并将其粘贴到 Chrome

How to create EmberJS app and stick it into Chrome

我正在尝试创建一个基本的 Ember 应用程序,然后插入 Chrome 扩展程序。我希望 Chrome 扩展接管 newtab 功能。最终目标是在我打开新标签页时看到 Ember 欢迎应用程序。

这是我的 manifest.json:

{
  "manifest_version": 2,
  "name": "My Cool Extension",
  "version": "0.1",
  "description": "Build an Extension!",
  "permissions": ["storage", "activeTab", "geolocation"],
  "background": {
    "scripts": ["background.js"]
  },
  "content_scripts": [
    {
      "matches": [
        "<all_urls>"
      ],
      "js": ["jquery-2.2.4.min.js", "content.js"]
    }
  ],
  "browser_action": {
    "default_icon": {
      "16": "icon.png"
    }
  },
  "chrome_url_overrides": { "newtab": "index.html" }
}

我是 运行 Ember CLI 3.10,这是一个全新的 EmberJS 应用程序。我 运行 ember build --environment production 并将 dist 文件夹复制到包含我的 manifest.jsonchrome 文件夹中。我在 manifest.json 中引用了我构建的 index.html 文件。我 运行 遇到的问题是,当我打开一个新页面时,我得到 UnrecognizedURLError: /index.html 来自我的指纹 vendor.js。这是为什么?我该如何解决这个问题?

啊!我需要在我的 config/environment.js 文件中将 locationType 设置为 'none'

module.exports = function(environment) {
  let ENV = {
    modulePrefix: 'my-project',
    environment,
    rootURL: '/',
    locationType: 'none', // changed from 'auto'
    …
  }

我的想法是 disable URL management