question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

This does not work when using ES6 module import synthax

import express from 'express'

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
olalondecommented, Aug 18, 2016

It should be the same as with require().

import something from 'some-module'

compiles to

var something = require('some-module')

and

import something from './some-module'

compiles to

var something = require('./some-module')

etc. 😃

https://babeljs.io/repl/#?evaluate=true&lineWrap=false&presets=es2015%2Creact%2Cstage-2&experimental=false&loose=false&spec=false&code=import something from ‘some-module’

1reaction
siddharthkpcommented, Oct 23, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

ES6 In Depth: Modules - the Web developer blog
An ES6 module is a file containing JS code. There's no special module keyword; a module mostly reads just like a script.
Read more >
16. Modules - Exploring JS
ES6 modules are stored in files. There is exactly one module per file and one file per module. You have two ways of...
Read more >
ES6 - Modules - Tutorialspoint
A module organizes a related set of JavaScript code. A module can contain variables and functions. A module is nothing more than a...
Read more >
A Comprehensive Look at ES6 Modules - JavaScript Tutorial
An ES6 module is a JavaScript file that executes in strict mode only. It means that any variables or functions declared in the...
Read more >
ES6 Modules in Node - DEV Community ‍ ‍
Tale of Two Options · CommonJS (Node) – the module system created for Node. · ES6 Modules (Native) – the specification written by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found