Feature: Runtime loaders, transpilation at import time · Issue #96 · nodejs/modules (original) (raw)

This repository was archived by the owner on Sep 2, 2023. It is now read-only.

This repository was archived by the owner on Sep 2, 2023. It is now read-only.

@GeoffreyBooth

Description

@GeoffreyBooth

Just as we can do:

app.coffee

require 'coffeescript/register' { slice } = require './pizza.coffee'

or

// app.js require('babel/register'); const { slice } = require('./pizza.js');

we should be able to achieve the equivalent in ESM, e.g. import a CoffeeScript file or import a JavaScript file that requires transpilation. References: CoffeeScript register, babel-register.

Use case 4. Related to #82.