@tinkoff/is-modern-lib
TypeScript icon, indicating that this package has built-in type declarations

3.0.4 • Public • Published

@tinkoff/is-modern-lib

RegExp for check packages from node_modules that are distributed in ES2015+.

This RegExp might be used to determine modules which should be transpiled to ES5.

Usage

Based on example from the article Publish, ship, and install modern JavaScript

// webpack.config.js
const { modernLibsFilter } = require('@tinkoff/is-modern-lib');

module.exports = {
  module: {
    rules: [
      // Transpile for your own first-party code:
      {
        test: /\.[cm]?js$/i,
        loader: 'babel-loader',
        exclude: /node_modules/,
      },
      // Transpile modern dependencies:
      {
        test: /\.[cm]?js$/i,
        include: modernLibsFilter,
        use: {
          loader: 'babel-loader',
          options: {
            babelrc: false,
            configFile: false,
            presets: ['@babel/preset-env'],
          },
        },
      },
    ],
  },
};

/@tinkoff/is-modern-lib/

    Package Sidebar

    Install

    npm i @tinkoff/is-modern-lib

    Weekly Downloads

    918

    Version

    3.0.4

    License

    Apache-2.0

    Unpacked Size

    12.2 kB

    Total Files

    6

    Last publish

    Collaborators

    • yeahga
    • sradyukov
    • hondasmx
    • makar_l
    • tinkoffbank
    • dmitry-korolev
    • rouland
    • ishivan
    • ytsareva
    • shoom3301
    • waterplea
    • meskill
    • marsibarsi
    • zig-green
    • super_oleg
    • dersizes
    • alexkvak