How to use module import in nodejs

Issue #752

Use esm

1
npm install esm

In our code, import as normal

1
2
3
4
const fs = require('fs');
// intended to be run after babel, and in ./dist folder
import factory from 'data'
const shell = require('shelljs')

Then use esm to convert

1
2
3
4
5
6
7
8
{
"name": "generator",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "npx babel index.js --out-file dist/index.js && node -r esm dist/index.js"
}
}

Read more

Comments

You need to set client_id and slot_id to show this AD unit. Please set it in _config.yml.