next-transpile-modules
Advanced tools
Comparing version 2.2.0 to 2.3.0
28
index.js
@@ -33,2 +33,3 @@ const path = require('path'); | ||
const { transpileModules = [] } = nextConfig; | ||
console.log('test', transpileModules); | ||
const includes = generateIncludes(transpileModules); | ||
@@ -49,14 +50,17 @@ const excludes = generateExcludes(transpileModules); | ||
config.externals = config.externals.map(external => { | ||
if (typeof external !== 'function') return external; | ||
return (ctx, req, cb) => { | ||
return includes.find(include => | ||
req.startsWith('.') | ||
? include.test(path.resolve(ctx, req)) | ||
: include.test(req) | ||
) | ||
? cb() | ||
: external(ctx, req, cb); | ||
}; | ||
}); | ||
// Since Next.js 8.1.0, config.externals is undefined | ||
if (config.externals) { | ||
config.externals = config.externals.map(external => { | ||
if (typeof external !== 'function') return external; | ||
return (ctx, req, cb) => { | ||
return includes.find(include => | ||
req.startsWith('.') | ||
? include.test(path.resolve(ctx, req)) | ||
: include.test(req) | ||
) | ||
? cb() | ||
: external(ctx, req, cb); | ||
}; | ||
}); | ||
} | ||
@@ -63,0 +67,0 @@ // Add a rule to include and parse all modules |
{ | ||
"name": "next-transpile-modules", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -84,5 +84,9 @@ # Next.js + Transpile `node_modules` | ||
### I have trouble with transpilation and Flow/TypeScript | ||
In your Next.js app, make sure you use a `babel.config.js` and not a `.babelrc` as Babel's configuration file (see explanation below). | ||
### I have trouble with transpilation and Yarn workspaces | ||
If you get a transpilation error when using Yarn workspaces, make sure you are using a `babel.config.js` and not a `.babelrc`. The former is a project-wide Babel configuration, when the latter works for relative paths only (and won't work as Yarn install dependencies in a parent directory). | ||
If you get a transpilation error when using Yarn workspaces, make sure you are using a `babel.config.js` and not a `.babelrc`. The former is [a project-wide Babel configuration](https://babeljs.io/docs/en/config-files), when the latter works for relative paths only (and won't work as Yarn install dependencies in a parent directory). | ||
@@ -89,0 +93,0 @@ ### I have trouble with Yarn and hot reloading |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9833
83
127