Skip to content

3.0.0

Compare
Choose a tag to compare
@martpie martpie released this 20 Jan 12:44
· 388 commits to master since this release

next-transpile-modules-3.0 introduces some important new features, bugfixes, and a minor breaking change. The breaking changes are indicated by the ⚠️ icon.

If you face problems with this new version please open an issue :)

⚠️ New plugin invocation

To avoid polluting the global config object with the transpileModule property, next-transpile-modules now exposes a function that takes an array of strings (the modules you want to transpile) as its first parameter.

In action:

// next.config.js
- const withTM = require('next-transpile-modules');
+ const withTM = require('next-transpile-modules')(['somemodule', 'and-another']);
 
module.exports = withTM({
-  transpileModules: ['somemodule', 'and-another']
});

This notation was inspired by @next/bundle-analyzer.

Added support Next.js 9.2 CSS features

In next@9.2 was added support for CSS files (as CSS modules or global CSS). next-transpile-modules will now let your transpiled packages include CSS, and will allow you to import global CSS in pages/_app.js.

More details are available in the documentation.

Bugfixes

Potentially breaking bugfixes depending on your setup:

  • ⚠️ a transpiled module whose name was a substring of another module (let's call it A) won't make A to be transpiled anymore

For example: transpiling core won't make core-js to be transpiled too anymore.

  • ⚠️ nested node_modules directories are now correctly ignored.

For example, if you want to transpile @shared/ui, @share/ui/node_modules/lodash won't get transpiled anymore.

Misc

  • Unit-tests were refined to handle some edgecases
  • End-to-end tests were added to ensure developing/refactoring this plugin with more confidence
  • Added Prettier