
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
next-plugin-transpile-modules
Advanced tools
Next.js plugin to transpile code from node_modules (supports TypeScript)
node_modules
Transpile untranspiled modules from node_modules
.
Makes it easy to have local libraries and keep a slick, manageable dev experience.
Next.js version | Plugin version |
---|---|
Next.js 8 | 2.x |
Next.js 6 / 7 | 1.x |
npm install --save next-plugin-transpile-modules
or
yarn add next-plugin-transpile-modules
Classic:
// next.config.js
const withTM = require('next-plugin-transpile-modules');
module.exports = withTM({
transpileModules: ['somemodule', 'and-another']
});
note: please declare withTM
as your last plugin (the "most nested" one).
With next-typescript
:
const withTypescript = require('@zeit/next-typescript');
const withTM = require('next-plugin-transpile-modules');
module.exports = withTypescript(
withTM({
transpileModules: ['somemodule', 'and-another']
})
);
@weco/next-plugin-transpile-modules
?@weco
's seems deadNext.js 7 introduced Webpack 4 and Babel 7, which changed a couple of things, especially for TypeScript and Flow plugins.
If you have a transpilation error when loading a page, check that your .babelrc
/babel.config.js
is up to date and valid, you may have forgotten a preset there.
If you add a local library (let's say with yarn add ../some-shared-module
), Yarn will copy those files by default, instead of symlinking them. So your changes to the initial folder won't be copied to your Next.js node_modules
directory.
You can go back to npm
, or use Yarn workspaces. See an example in the official Next.js repo.
Lerna's purpose is to publish different packages from a monorepo, it does not help for and do not intend to help local development with local modules.
This is not coming from me, but from Lerna's maintainer.
So you are probably using it wrong, and I advice you to use npm
or Yarn workspaces instead.
FAQs
Next.js plugin to transpile code from node_modules (supports TypeScript)
The npm package next-plugin-transpile-modules receives a total of 501 weekly downloads. As such, next-plugin-transpile-modules popularity was classified as not popular.
We found that next-plugin-transpile-modules demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.