Wondering what’s next for npm?Check out our public roadmap! »

@rajzik/config-babel
TypeScript icon, indicating that this package has built-in type declarations

3.1.9 • Public • Published

Babel Config

Factory functions for creating preset Babel configurations. Primarily used in unison with the Lumos CLI.

Extending config

Update package.json:

{
  "lumos": {
    "eslint": {
      "plugins": ["styled-components"]
    }
  }
}

Create file in configs folder:

configs/babel.js

modules.exports = {
  plugins: ['styled-components'],
};

Settings

Main settings

interface BabelOptions {
  env?: LumosEnvSetting;
  esm?: boolean;
  graphql?: boolean;
  library?: boolean;
  next?: boolean;
  node?: boolean;
  react?: boolean;
  typescript?: boolean;
  empty?: boolean;
  srcFolder: string;
}
interface LumosEnvSetting {
  targets?:
    | string
    | string[]
    | {
        browsers?: string | string[];
        esmodules?: boolean;
        node?: string | 'current' | true;
        safari?: string | 'tp';
        [keystring]unknown;
      };
  spec?: boolean;
  loose?: boolean;
  modules?: 'amd' | 'umd' | 'systemjs' | 'commonjs' | 'cjs' | 'auto' | false;
  debug?: boolean;
  include?: (string | RegExp)[];
  exclude?: (string | RegExp)[];
  useBuiltIns?: 'usage' | 'entry' | false;
  forceAllTransforms?: boolean;
  configPath?: string;
  ignoreBrowserslistConfig?: boolean;
  shippedProposals?: boolean;
}

Default values

{
  env = {
    loose: true,
    modules: esm ? false : 'commonjs',
    shippedProposals: next,
    targets: node ? NODE_TARGET : WEB_TARGET,
  },
  esm = false,
  graphql = false,
  library = false,
  next = false,
  node = false,
  react = false,
  typescript = false,
  empty = false,
}

Options

  • env
    • Babel preset evn config
  • buildFolder
    • Defines build folder
  • react
    • Enable/Disable react usage
  • typescript
    • Enable/Disable typescript usage
  • esm
    • Enable/Disable esm bundle
  • empty
    • This will generate empty babelrc
    • This can be handy when you need special babelrc config
  • graphql
    • Enable/Disable graph QL usage
  • library
    • Enable/Disable optimization for library
  • next
    • Enable/Disable experimental plugins
  • node
    • Enable/Disable only node support

CLI Options

  • --[no-]clean (bool) - Clean the target --out-dir before transpiling. Defaults to true.

Beemo/babel

Install

npm i @rajzik/config-babel

DownloadsWeekly Downloads

68

Version

3.1.9

License

MIT

Unpacked Size

304 kB

Total Files

29

Last publish

Collaborators

  • avatar