using ember ember-drag-sort with emblem templates - ember.js

Error parsing code while looking for "npm:" imports in file: /{path}/tmp/stub_generator-input_base_path-8FTPYOxJ.tmp/dash/tests/pages/components/_component.js
SyntaxError: Unexpected token (35:13)
this when i try to run my project or build
i am using
ember 3.12
emblem 0.12.0
ember-drag-sort 3.0

I have figured out the problem it maby because of spread es6 so
I added
babel: {
plugins: [require.resolve('#babel/plugin-proposal-object-rest-spread')]
},
to ember-cli-build.js it worked

Related

Am getting the error "Unknown template object: function" in my ember 1.9.1 app?

I've upgraded my ember version to 1.9.1 and handlebar version to 2.0.0. But now getting the error "Unknown template object: function" in app. The app worked perfectly with ember 1.8.1 and handlebars 1.3.0.
As I suspected, you're not using the correct template compiler for your version of Ember. The grunt-ember-templates readme has instructions on this, but the gist is that you need to point it to the correct template compiler like this:
options: {
templateCompilerPath: 'bower_components/ember/ember-template-compiler.js',
handlebarsPath: 'bower_components/handlebars/handlebars.js',
templateNamespace: 'HTMLBars'
}
You can also look at this pull request for more details.

How to use webpack import aws-sdk

I found this issues in the official, but it looks like they refused to answer.
So I can only ask questions on SO.
Here is my Error&Warning Log:
WARNING in ./~/aws-sdk/lib/util.js
Critical dependencies:
40:30-45 the request of a dependency is an expression
43:11-53 the request of a dependency is an expression
# ./~/aws-sdk/lib/util.js 40:30-45 43:11-53
WARNING in ./~/aws-sdk/lib ^\.\/.*$
Module not found: Error: Cannot resolve directory '.' in /Users/me/Documents/Sources/my-project/client/node_modules/aws-sdk/lib
# ./~/aws-sdk/lib ^\.\/.*$
WARNING in ./~/aws-sdk/lib/api_loader.js
Critical dependencies:
13:15-59 the request of a dependency is an expression
104:12-46 the request of a dependency is an expression
108:21-58 the request of a dependency is an expression
114:18-52 the request of a dependency is an expression
# ./~/aws-sdk/lib/api_loader.js 13:15-59 104:12-46 108:21-58 114:18-52
WARNING in ./~/aws-sdk/lib/region_config.json
Module parse failed: /Users/me/Documents/Sources/my-project/client/node_modules/aws-sdk/lib/region_config.json Line 2: Unexpected token :
You may need an appropriate loader to handle this file type.
| {
| "rules": {
| "*/*": {
| "endpoint": "{service}.{region}.amazonaws.com"
# ./~/aws-sdk/lib ^\.\/.*$
ERROR in ./~/aws-sdk/lib/api_loader.js
Module not found: Error: Cannot resolve module 'fs' in /Users/me/Documents/Sources/my-project/client/node_modules/aws-sdk/lib
# ./~/aws-sdk/lib/api_loader.js 1:9-22
ERROR in ./~/aws-sdk/lib/services.js
Module not found: Error: Cannot resolve module 'fs' in /Users/me/Documents/Sources/my-project/client/node_modules/aws-sdk/lib
# ./~/aws-sdk/lib/services.js 1:9-22
There are three types:
Cannot resolve module 'fs'
I only need to install fs can solve this.
need an appropriate loader
Well, this will need to install json-loader, and set it in webpack.config.js, but also can solve.
Critical dependencies
Module not found: Error: Cannot resolve directory '.'
I webpack newbie.So, i don't know how to solve this.
Will someone help me? thanks.
UPDATE:
Module not found: Error: Cannot resolve directory '.'
that is my fault, config file's extensions missing a .
I found this blog post that fixed it for me.
Essentially you need to import the built version of the library.
All credit goes to the author. Here is the code:
require('aws-sdk/dist/aws-sdk');
var AWS = window.AWS;
ES6 version:
import 'aws-sdk/dist/aws-sdk';
const AWS = window.AWS;
config:
module: {
noParse: [
/aws/
]
}
usage:
window.AWS to the reference of the global AWS object.
Using the noParse method should work if you are creating a node package, as this is setting webpack to not apply any parsing/loaders. This did not work for me when creating a umd formatted output file/library.
To create a umd formatted library I had to use loaders to Browserify aws-sdk and handle json files.
Install the loaders:
npm install json-loader --save-dev
npm install transform-loader brfs --save-dev
Webpack Config:
module: {
loaders: [
{ test: /aws-sdk/, loaders: ["transform?brfs"]},
{ test: /\.json$/, loaders: ['json']},
]
},
output: {
library: 'LibraryName',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js']
}
Replace LibraryName with you own namespacing. Currently the library would be used through a constructor as follows:
var libObj = new LibraryName();
AWS SDK added support to webpack starting from version 2.6.1, please see Using webpack and the AWS SDK for JavaScript to Create and Bundle an Application – Part 1 blog post describing how to require aws-sdk into webpack bundle.
use npm install json-loader --save-dev
add the following code to webpack.config.js
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/,
},
{
test: /.json$/,
loaders: ['json']
}]
}
Just import * as AWS from 'aws-sdk'
Notice that we specified a loader to tell webpack how to handle importing JSON files, in this case by using the json-loader we installed earlier. By default, webpack only supports JavaScript, but uses loaders to add support for importing other file types as well. The AWS SDK makes heavy use of JSON files, so without this extra configuration, webpack will throw an error when generating the bundle.
Update(2015-10-20):
aws-sdk fix this. i can use it from npm.
thanks, aws-sdk team.

ember-cli 0.0.37 import new syntax and ember-data

I've recently upgraded from ember-cli 0.0.36 to 0.0.37 and have been struggling to import ember-data. Although seemingly simple, it's not working for me. In the Brocfile.js, the old import was
app.import({
development: 'vendor/ember-data/ember-data.js',
production: 'vendor/ember-data/ember-data.prod.js'
});
This was modified to comply with the new syntax:
app.import('vendor/ember-data/ember-data.js', { exports: { ember: ['default'] } });
however, I get the following error:
app.import(vendor/ember-data/ember-data.js) - Passing modules object is deprecated. Please pass an option object with modules as export key (see http://git.io/H1GsPw for more info).
I'm not sure how to proceed with this one so any help is much appreciated.
The new syntax is detailed here
As mentioned in the deprecated message this is the new syntax.
app.import({
development: 'vendor/ember-data/ember-data.js',
production: 'vendor/ember-data/ember-data.prod.js'
}, {
exports: {
'ember-data': ['default']
}
});
This error message was the result of leftovers from the old ember-cli-ember-data shim which was set to version 0.0.4 in the package.json file. I've changed it to 0.1.0 which is the latest as of this writing, removed (deleted) the old ember-cli-ember-data directory from the node_modules package directory and reran npm install. This resulted in the warning message disappearing.

How to import named amd's and its exports in ember-cli

I'm trying to import ic-modal into an ember-cli project, but for some reason I keep getting this error:
Uncaught Error: <ic-test#view:toplevel::ember278> Handlebars error: Could not find property 'ic-modal-trigger' on object (generated application controller).
I have the following import statements:
app.import('vendor/ic-styled/main.js');
app.import('vendor/ic-modal/dist/named-amd/main.js', {
'ic-modal': [
'ModalComponent',
'ModalFormComponent',
'ModalTriggerComponent',
'ModalTitleComponent',
'modalCss'
]
});
Any help with this would be great?!
In Brocfile.js:
app.import('bower_components/ic-styled/main.js');
app.import('bower_components/ic-modal/dist/named-amd/main.js');
Replace bower_components with vendor in the above if you're still using an older version of Ember-CLI.
Then use:
import ICModal from 'ic-modal';
// Can now utilise ICModal, ICModal.ModalForm etc
The Broccoli build and ES6 module transpiler should take care of the rest.
(Side-note: when using Coffeescript, put the import statement in backticks as the standard Coffeescript compiler doesn't handle the ES6 syntax.)

handlebars.js is not recognised by ember

I try to update https://github.com/trek/ember-todos-with-build-tools-tests-and-other-modern-conveniences
with the newest versions of some scripts. All work except Ember (1.2.0) gives an error:
Assertion failed: Ember Handlebars requires Handlebars version 1.0 or 1.1. Include a SCRIPT tag in the HTML HEAD linking to the Handlebars file before you link to Ember.
Error disappears when I activate the same script without dependencies but with
<script src="../dependencies/handlebars.js"></script>
I think question should be marked as answered. I got it work with https://github.com/gcollazo/brunch-with-ember-reloaded