# webpack-babel-link

> [Babel-loader can't compile a npm linked module](https://github.com/babel/babel-loader/issues/149). Work arround is to use `require.resolve` trick. This is a simple module that use this trick.

Latest version **1.1.0** (published 2017-02-17) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install webpack-babel-link
pnpm add webpack-babel-link
yarn add webpack-babel-link
bun add webpack-babel-link
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-02-17 |
| First published | 2017-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | blackChef |
| Maintainers | blackchef |

## Links

- npm: https://www.npmjs.com/package/webpack-babel-link
- Repository: https://github.com/blackChef/webpack-babel-link
- npm.io page: https://npm.io/package/webpack-babel-link

## Recent versions

- 1.1.0 (latest) — 2017-02-17

## README

# webpack-babel-link
[Babel-loader can't compile a npm linked module](https://github.com/babel/babel-loader/issues/149). 
Work arround is to use `require.resolve` trick. This is a simple module that use this trick.

# Api
```
resolveBabel :: type -> require -> pluginName -> require.resolve(`babel-${type}-${pluginName}`)
resolvePreset :: require -> pluginName -> require.resolve(`babel-preset-${pluginName}`)
resolvePlugin :: require -> pluginName -> require.resolve(`babel-plugin-${pluginName}`)
```

# Usage
```

// In your webpack.config file

let resolvePreset = require('webpack-babel-link').resolvePreset(require);

module.exports = {
  ...
  module: {
    rules: [{
      test: /\.jsx?$/,
      loader: 'babel-loader',
      query: {
        presets: ['es2015', 'react'].map(resolvePreset)
      }
    }]
  }
};

---
_Source: https://npm.io/package/webpack-babel-link · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
