Socket
Socket
Sign inDemoInstall

next-transpile-modules

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-transpile-modules - npm Package Compare versions

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc