Skip to content

Commit

Permalink
TypeScript support
Browse files Browse the repository at this point in the history
  • Loading branch information
martpie committed Aug 9, 2018
1 parent 028558e commit 3ff72bd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ module.exports = (nextConfig = {}) => {
return (ctx, req, cb) =>
(Boolean(includes.find(include => include.test(req))) ? cb() : external(ctx, req, cb))
})

config.module.rules.push({
test: /\.+(js|jsx)$/,
test: /\.+(js|jsx|ts|tsx)$/,
loader: options.defaultLoaders.babel,
include: includes
})
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@weco/next-plugin-transpile-modules",
"name": "next-plugin-transpile-modules",
"version": "0.0.1",
"main": "index.js",
"license": "MIT",
"repository": "wellcometrust/next-plugin-transpile-modules",
"repository": "KeitIG/next-plugin-transpile-modules",
"dependencies": {},
"devDependencies": {
"webpack": "^3.10.0"
Expand Down
14 changes: 8 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@
Transpile untranspiled modules from your `node_modules`.
Makes it easy to have local libraries and keep a slick, manageable dev experience.

⚠️ The main difference with `@weco/next-plugin-transpile-modules` is this one support Next's `with-typescript` plugin: you can transpile TypeScript files.

## Installation

```
npm install --save @weco/next-plugin-transpile-modules
npm install --save next-plugin-transpile-modules
```

or

```
yarn add @weco/next-plugin-transpile-modules
yarn add next-plugin-transpile-modules
```

## Usage

```js
// next.config.js
const withTM = require('@weco/next-plugin-transpile-modules')
const withTM = require('next-plugin-transpile-modules');

module.exports = withTM({
transpileModules: ['@weco']
})
transpileModules: ['somemodule', 'oranother']
});
```

0 comments on commit 3ff72bd

Please sign in to comment.