Sashqa2020-01-28 12:32:36
Sashqa, 2020-01-28 12:32:36

Another error in node js export?

export { default as add } from './add.js';

SyntaxError: Unexpected token export

Error in lodash

from lodash import only tsconfig file

import { get, isNil } from 'lodash-es';

  "compileOnSave": false,
  "compilerOptions": {
    "importHelpers": true,
    "outDir": "./dist/out-tsc",
    "baseUrl": "./",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "allowJs": true,
    "typeRoots": [
    "lib": [
    "module": "commonjs"

What could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Robur, 2020-01-28

This is a re-export (import+export in one statement).
You either need a more recent node or use the lodash module instead of lodash-es

Alexander, 2020-01-28

This design should have import.
And exportspelled differently

const greeting = (name) => console.log(`Hello, ${name}`);

export default greeting;
/* или */
export { greeting };
And import'ыit will be different for both cases. For the first and for the secondimport greeting from './file.js';import { greeting } from './file.js';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question