Closed videni closed 4 years ago
const nextConfig = { useFileSystemPublicRoutes: false, webpack: (config) => { console.log(1); // not output, this one is not executed config.resolve.alias = { ...config.resolve.alias, 'react-jsonschema-form': '@vidyvideni/react-jsonschema-form', '@': path.resolve(__dirname, 'src'), }; return config; } }
module.exports = withPlugins([ [withTM, { transpileModules: [ '@ant-design/pro-layout', 'antd', ], // If I remove this webpack, the above one will execute, why? webpack: (config, options) => { console.log(2) ; // output 2, this one is executed. config.resolve.alias = { ...config.resolve.alias, '@ant-design/pro-layout': require.resolve('@ant-design/pro-layout'), 'antd': require.resolve('antd'), }; return config; }, }] ], nextConfig)
This is unfortunately a limitation by next. You will have to define everything inside one webpack function.
next
webpack