import statement NodeJs code example

Example 1: node package.json type module

node --experimental-modules app.js

Example 2: how to import in node

const http = require('http');
const { router } = require('./routes');

Example 3: import syntax node

import defaultExport from "module-name";
import * as name from "module-name";
import { export1 } from "module-name";
import { export1 as alias1 } from "module-name";
import { export1 , export2 } from "module-name";
import { foo , bar } from "module-name/path/to/specific/un-exported/file";
import { export1 , export2 as alias2 , [...] } from "module-name";
import defaultExport, { export1 [ , [...] ] } from "module-name";
import defaultExport, * as name from "module-name";
import "module-name";
var promise = import("module-name");

Example 4: ext js import statement

import { define }     from 'extjs-kernel'; // module names not final
    import { Observable } from 'extjs-core';
 
    import { Base }       from 'app-some';
 
    @define({
        mixins: Observable,
        config: {
            value: null
        }
    })
    export default class Foo extends Base {
        updateValue (value, oldValue) {
            this.fireEvent('valuechange', value, oldValue);
        }
    }