next-plugin-preval icon indicating copy to clipboard operation
next-plugin-preval copied to clipboard

Feature request: transpile dependencies (with next-transpile-modules)

Open fabien opened this issue 3 years ago • 0 comments

I'm using https://github.com/martpie/next-transpile-modules within a mono-repo for a smooth dev experience. Unfortunately, it is not compatible with next-plugin-preval.

In theory next-transpile-modules would run before next-plugin-preval and it should all just work, but this is not the case. I need them in reverse order to actually have a working app at all.

Would be awesome if it would work transparently.

const withPlugins = require('next-compose-plugins');
const transpileModules = require('next-transpile-modules');
const withTranslations = require('next-translate');

const withPreval = require('next-plugin-preval/config')();

const withBundleAnalyzer = require('@next/bundle-analyzer')({
  enabled: process.env.ANALYZE === 'true',
});

const coreModules = [];

const nextConfig = {};

const withTM = transpileModules(
  ['lodash-es', ...coreModules],
  {
    resolveSymlinks: true
  }
);

return withPlugins(
  [
    withPreval(), // first
    withTM, // second
    withTranslations,
    withBundleAnalyzer
  ],
  nextConfig
);

fabien avatar Jun 14 '21 15:06 fabien