Next.js默认不会编译主文件夹外的node_modules内的transpile模块,因此在运行时你会在flow语法上出现异常。
我使用的是 下一个分册模块 以便移植特定的模块。
// next.config.js
const withTM = require('next-transpile-modules')(['shared-ui', 'other-shared-lib']);
modules.exports = withTM({
...regular next config
});