npm

@mels/babel-preset-tsc-pluggable

1.0.0 • Public • Published

@mels/babel-preset-tsc-pluggable

npm (scoped) code style: prettier

Pluggable babel preset for some of my commonly used TypeScript and Styled Components configs.

Plugins

This preset implements the following plugins:

Install

With npm...

npm install @mels/babel-preset-tsc-pluggable --save-dev

With yarn...

yarn add @mels/babel-preset-tsc-pluggable -D

Usage

.babelrc

{
  "presets": ["@mels/tsc-pluggable"]
}

With Next.js:

{
  "presets": ["next/babel", "@mels/tsc-pluggable"]
}

Each plugin is turned on by default, but can be turned off manually:

{
  "presets": [
    "next/babel",
    [
      "@mels/tsc-pluggable",
      {
        "moduleResolver": false,
        "proptypes": false,
        "styledComponents": false
      }
    ]
  ]
}

Module Resolver Usage with TypeScript

This preset sets the following options for the module resolver:

{
  root: ['./'],
  alias: {
    components: './src/components'
  },
  extensions: ['.js', '.jsx', '.ts', '.tsx']
}

In addition to this, to get things working properly you'll need to set baseUrl and paths in tsconfig.json, e.g:

{
  "baseUrl": ".",
  "paths": {
    "components/*": ["src/components/*"]
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @mels/babel-preset-tsc-pluggable

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

4.73 kB

Total Files

4

Last publish

Collaborators

  • melanieseltzer