【发布时间】:2016-12-16 20:10:28
【问题描述】:
我创建了一个 ember 插件,它依赖于 gulp 派生的包来构建,所以在插件中它在 package.json 中有以下内容。
当插件包含在主应用程序中时,由于缺少各种 gulp 模块,构建失败。该插件位于主应用程序的 devDependencies 部分。
当插件通过npm link 进入时,它也会构建到主应用程序中。我的问题是如何处理插件依赖项,以便在没有模块本地副本的情况下构建主应用程序?
更新:我认为问题在于包在 postinstall 之后进行了 gulp 构建,这将 gulp devDependencies 提升为真正的依赖项。这是正确的吗?
插件 JSON 文件
{
"name": "My Addon",
"version": "0.0.0",
"description": "The default blueprint for ember-cli addons.",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember try:each",
"postinstall": "gulp build && bower install"
},
"repository": {
"type": "git",
"url": "git://github.com/myaddon.git"
},
"engines": {
"node": ">= 0.12.0"
},
"author": "",
"license": "MIT",
"devDependencies": {
"bootstrap": "^4.0.0-alpha.5",
"broccoli-asset-rev": "^2.4.5",
"broccoli-funnel": "^1.0.9",
"ember-ajax": "^2.4.1",
// more ember modules
"find-root": "^0.1.1",
"font-awesome": "^4.7.0",
"glob": "^4.5.3",
"gulp": "^3.9.1",
"gulp-clean-css": "^2.2.1",
"gulp-concat": "^2.6.0",
"gulp-connect": "^2.2.0",
"gulp-filter": "^3.0.1",
"gulp-git": "^1.4.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-sourcemaps": "^1.5.2",
"gulp-task-loader": "^1.2.1",
"gulp-template": "^3.0.0",
"gulp-uglify": "^1.2.0",
"gulp-zip": "^3.0.2",
"lazypipe": "^1.0.1",
"loader.js": "^4.0.10",
"run-sequence": "^1.1.2"
},
"keywords": [
"ember-addon"
],
"dependencies": {
"ember-cli-babel": "^5.1.7"
},
"ember-addon": {
"configPath": "tests/dummy/config"
}
}
【问题讨论】:
标签: node.js ember.js npm npm-install