@start/plugin-lib-esm-loader
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

🏭 plugin-lib-esm-loader

Copy a predefined ESM loader file to a directory.

Install

$ yarn add --dev @start/plugin-lib-esm-loader

Usage

Signature

copyEsmLoader(outDir: string, filename: string = 'esm-loader.js')

Example

{
  "name": "my-package",
  "version": "1.0.0",
  "main": "build/esm-loader.js",
  "module": "build/index.js",
  "dependencies": {
    "esm": "^3.0.75"
  }
}
import sequence from '@start/plugin-sequence'
import find from '@start/plugin-find'
import read from '@start/plugin-read'
import babel from '@start/plugin-lib-babel'
import write from '@start/plugin-write'
import copyEsmLoader from '@start/plugin-lib-esm-loader'

const babelConfig = {
  // …
  babelrc: false,
  sourceMaps: true,
  presets: [
    ['@babel/preset-env', {
      targets: { node: 6 },
      modules: false
    }]
  ]
}

export const task = () =>
  sequence(
    find('src/**/*.js'),
    read,
    babel(babelConfig),
    write('build/'),
    copyEsmLoader('build/')
  )

Package Sidebar

Install

npm i @start/plugin-lib-esm-loader

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

3.93 kB

Total Files

6

Last publish

Collaborators

  • fosimus
  • psxcode
  • deepsweet