Importing ES2015 module throw syntax error
See original GitHub issueI’m submitting a bug report
- Library Version: 0.21.1 (aurelia-cli)
- Operating System: OSX 10.12.3
- Node Version: 7.4.0
- NPM Version: 4.0.5
- Browser: all
- Language: TypeScript 2.2.1
Current behavior:
I have installed a library that’s coded using ES2015 syntax and when I’m requiring it inside the aurelia_project/aurelia.json
esprima
give me syntax error.
{ uid: 0,
name: '<series>',
branch: true,
error:
Error: Parse error using esprima for file: /Users/romainlanz/workspace/app.org/node_modules/myPackage/lib/index.js
Error: Line 2: Unexpected token
....
}
Here’s the content of the file (TypeScript compiled to ES2015):
'use strict';
export * from './Auth';
export * from './Beach';
export * from './Requests';
export * from './Services';
export * from './Core';
//# sourceMappingURL=index.js.map
What is the expected behavior? I expect Aurelia to require my package without throwing an error.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:20 (18 by maintainers)
Top Results From Across the Web
Javascript ES2015 import throws Uncaught SyntaxError
I can reference css files from my main.css by adding @import "@material/textfield/dist/mdc.textfield.css"; to the start of my stylesheet. This ...
Read more >JS Fix For "SyntaxError: Cannot Use Import Statement Outside ...
This is most likely triggered when a file tries to use both import and require module patterns, which isn't possible. You'll need to...
Read more >import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live bindings ... or "function body" as parsing goals), a SyntaxError is thrown.
Read more >cannot use import statement outside a module - You.com
json will tell Node you are using ES2015 modules, which should get rid of the error, but then you will need to tell...
Read more >Learn ES2015 - Babel.js
ES2015 classes are syntactic sugar over the prototype-based OO pattern. ... app.js import * as math from "lib/math"; console.log("2π = " + math.sum(math.pi, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@RomainLanz Is this issue resolved in version 0.30 of the CLI?
Yes, new tracer supports esm module format.