title: How to import es6 modules with babel-node?
body: <p>I have some trouble with writing a quick test for my node express application. The problem is: in my server's file I use es6 import to import my custom class. So there is a line like this:
  <code>import MyClass from 'src/myclass.js';</code></p>
  
  <p>my test script look like this:</p>
  
  <p><code>npx babel-node srv/server.js</code></p>
  
  <p>the error I get is the following:</p>
  
  <p><code>Syntax error: Unexpected identifier</code> the module name after import is highlighted </p>
  
  <p>So why I am doing that in first place? I've thought it would be nice to test my web application without running code transpiler each time I need to test it.</p>
  
  <p>I already tried to place --experimental-modules in test command, unfortunatelly it didn't work for me. My node version is : 11.14</p>
  
  <p>My entry point is like this </p>
  
  <pre><code>import MyClass form 'src/myclass.js';
  
  var myClass = new MyClass();
  </code></pre>
  
  <p>my class file is like this</p>
  
  <pre><code>export default MyClass {
   constructor() {
    ...
   }
  }
  
  </code></pre>
  
  <p>my babel configuration </p>
  
  <pre><code>require('@babel/register')({
      only: [__dirname + '/src', __dirname + '/srv'],
      ignore: [__dirname + 'node_modules'],
      presets: ['@babel/preset-env']
  });
  
  var presets = [
      [
          '@babel/preset-env',
          {
              'useBuiltIns': 'entry',
              'corejs': 'core-js@3'
          }
      ]
  ];
  
  var plugins = [
      [
          'module-resolver',
          {
              'root': ['./src'],
              'alias': {
                  'lance': './node_modules/lance-gg/dist'
              }
          }
      ]
  ];
  
  module.express = {
      presets,
      plugins
  };
  </code></pre>
  
  <p>So I would like to be able to start my node server to test my code without doing code transpilling (I will do it only in case I need a production building of my application).<br>
  I couldn't figured out how exactly I can do that. I would appreciate any help or link to some sort of manual.</p>