Skip to content

Instantly share code, notes, and snippets.

@dotnetCarpenter
Created July 20, 2018 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotnetCarpenter/9e073526ad62068bdc2183a3459e42d0 to your computer and use it in GitHub Desktop.
Save dotnetCarpenter/9e073526ad62068bdc2183a3459e42d0 to your computer and use it in GitHub Desktop.
es-check ES2015 modules
export default msg => { console.log(msg) }
import logger from './file1.mjs'
logger('hello from file2')
@dotnetCarpenter
Copy link
Author

node --experimental-modules file2.mjs 
(node:27209) ExperimentalWarning: The ESM module loader is experimental.
hello from file2

Using es-check 2.0.4

es-check file2.mjs 
ES-Check: there were no ES version matching errors! 
es-check es7 file2.mjs 
ES-Check: there were 1 ES version matching errors.

          ES-Check Error:
          ----
          · erroring file: file2.mjs
          · error: SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (1:0)
          · see the printed err.stack below for context
          ----

          SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (1:0)
    at Parser.pp$4.raise (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:2745:13)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment