我在做ember build --environment=production
时看到了一些奇怪的事情,那就是当我在我的服务器上运行构建的应用程序时,如果我只是进行开发构建,则会丢失某些依赖项。
当我转到我的应用程序的主页时,第一个错误显示在控制台中,并说" Ember.Handlebars.compile不是一个功能"进一步在我的应用程序中,我收到一个错误,我的pikaday组件(对于日期选择器)缺失,但同样,如果我只是ember build
,它不会丢失。
我不太擅长调试最小化的javascript,所以我不确定如何解决这个问题。
这是我的整个config / environment.js文件(忽略端点的东西,它只是我们的内部网):
/* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'star',
environment: environment,
baseURL: '/',
locationType: 'hash',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
};
if (environment === 'development') {
ENV.API_ENDPOINT = 'http://10.94.171.94';
ENV.AUTH_ENDPOINT = 'http://10.94.171.94';
// ENV.APP.LOG_RESOLVER = true;
ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === 'test') {
// Testem prefers this...
ENV.baseURL = '/';
ENV.locationType = 'auto';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
}
if (environment === 'production') {
ENV.API_ENDPOINT = 'http://10.94.171.94';
ENV.AUTH_ENDPOINT = 'http://10.94.171.94';
ENV.baseURL = '/';
locationType = 'hash';
}
ENV['simple-auth'] = {
//https://github.com/simplabs/ember-simple-auth/tree/master/packages/ember-simple-auth-cookie-store
store: 'simple-auth-session-store:cookie',
authorizer: 'authorizer:custom',
routeAfterAuthentication: 'projects',
authenticationRoute: 'index',
crossOriginWhitelist: [
ENV.API_ENDPOINT,
ENV.AUTH_ENDPOINT
]
}
return ENV;
};
Brocfile.js
/* global require, module */
var pickFiles = require('broccoli-static-compiler');
var mergeTrees = require('broccoli-merge-trees');
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var fontAwesome;
var app = new EmberApp({
vendorFiles: {
'es5-shim.js': 'bower_components/es5-shim/es5-shim.js',
'es5-sham.js': 'bower_components/es5-shim/es5-sham.js'
}
});
//these font files will be put into the assets/fonts folder in public/ and dist/
fontAwesome = pickFiles('vendor/sb-admin-2/font-awesome-4.2.0/fonts', {
srcDir: '/',
files: ['*'],
destDir: '/assets/fonts'
});
// Use `app.import` to add additional libraries to the generated
// output files.
//only using the js and font files from bootstrap, sass stylesheets are in app/styles
app.import(app.bowerDirectory + '/moment/moment.js');
app.import(app.bowerDirectory + '/respond/dest/respond.min.js');
app.import(app.bowerDirectory + '/bootstrap-sass-official/assets/javascripts/bootstrap/tooltip.js');
app.import('vendor/sb-admin-2/js/bootstrap.min.js');
app.import(app.bowerDirectory + '/ember-addons.bs_for_ember/dist/js/bs-core.min.js');
app.import(app.bowerDirectory + '/ember-addons.bs_for_ember/dist/js/bs-progressbar.min.js');
app.import(app.bowerDirectory + '/ember-addons.bs_for_ember/dist/js/bs-nav.min.js');
app.import(app.bowerDirectory + '/ember-addons.bs_for_ember/dist/js/bs-badge.min.js');
app.import('vendor/sb-admin-2/js/plugins/metisMenu/metisMenu.js');
app.import('vendor/sb-admin-2/css/plugins/metisMenu/metisMenu.css');
app.import('vendor/sb-admin-2/js/sb-admin-2.js');
//sb-admin-2 scss is imported in app/styles/app.scss
app.import('vendor/sb-admin-2/font-awesome-4.2.0/css/font-awesome.min.css');
//placholder attribute polyfill
app.import(app.bowerDirectory + '/better-dom/dist/better-dom-legacy.js');
app.import(app.bowerDirectory + '/better-dom/dist/better-dom.js');
app.import(app.bowerDirectory + '/better-placeholder-polyfill/dist/better-placeholder-polyfill.js');
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
module.exports = mergeTrees([
app.toTree(),
fontAwesome]);
bower.json
{
"name": "star",
"dependencies": {
"handlebars": "~1.3.0",
"jquery": "1.11.1",
"ember": "1.6.1",
"ember-data": "1.0.0-beta.10",
"ember-resolver": "0.1.8",
"loader.js": "stefanpenner/loader.js#1.0.1",
"ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.0.4",
"ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.2",
"ember-qunit": "0.1.8",
"ember-qunit-notifications": "0.0.4",
"qunit": "~1.15.0",
"moment": "~2.8.1",
"components-font-awesome": "~4.2.0",
"pikaday": "~1.2.0",
"ember-simple-auth": "0.6.7",
"better-placeholder-polyfill": "~1.2.0",
"es5-shim": "~4.0.1",
"html5shiv": "~3.7.2",
"respond": "~1.4.2",
"bootstrap-sass-official": "~3.3.0",
"ember-addons.bs_for_ember": "~0.7.0"
},
"resolutions": {
"jquery": ">= 1.7.0 < 2.2.0",
"ember": "1.6.1"
}
}
的package.json
{
"name": "star",
"version": "0.0.0",
"private": true,
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"start": "ember server",
"build": "ember build",
"test": "ember test"
},
"repository": "https://github.com/stefanpenner/ember-cli",
"engines": {
"node": ">= 0.10.0"
},
"author": "",
"license": "MIT",
"devDependencies": {
"body-parser": "^1.2.0",
"broccoli-asset-rev": "0.3.0",
"broccoli-ember-hbs-template-compiler": "^1.6.1",
"broccoli-merge-trees": "^0.2.0",
"broccoli-sass": "^0.2.2",
"broccoli-static-compiler": "^0.2.0",
"connect-restreamer": "^1.0.1",
"ember-cli": "0.1.1",
"ember-cli-ic-ajax": "0.1.1",
"ember-cli-inject-live-reload": "^1.2.2",
"ember-cli-qunit": "0.1.0",
"ember-cli-simple-auth": "^0.6.7",
"ember-cli-simple-auth-cookie-store": "^0.6.7",
"ember-data": "1.0.0-beta.10",
"ember-pikaday": "^0.1.0",
"express": "^4.8.5",
"glob": "^4.0.5",
"liquid-fire": "^0.12.0"
}
}
答案 0 :(得分:0)
使用ember-forms
时我发现了这个错误。如果您正在使用该库,则为currently has a dependency on the Handlebars runtime compiler(这不是bueno)。
您可以按照该问题来监控进度。