Commit 8c5e85d4 authored by Felix Mosheev's avatar Felix Mosheev Committed by Tim Neutkens

Check if dynamicOptions has the deprecated `method` property, (#7973)

* Check if dynamicOptions has the deprecated `method` property, closes #7972

* Update dynamic.tsx
parent 8e467bee
...@@ -120,11 +120,15 @@ export default function dynamic<P = {}>( ...@@ -120,11 +120,15 @@ export default function dynamic<P = {}>(
typeof dynamicOptions === 'object' && typeof dynamicOptions === 'object' &&
!(dynamicOptions instanceof Promise) !(dynamicOptions instanceof Promise)
) { ) {
if (process.env.NODE_ENV !== 'production') { // show deprecation warning for `modules` key in development
// show deprecation warning in development if (
console.warn( process.env.NODE_ENV !== 'production'
'The modules option for next/dynamic has been deprecated. See here for more info https://err.sh/zeit/next.js/next-dynamic-modules' ) {
) if(dynamicOptions.modules) {
console.warn(
'The modules option for next/dynamic has been deprecated. See here for more info https://err.sh/zeit/next.js/next-dynamic-modules'
)
}
} }
// Support for `render` when using a mapping, eg: `dynamic({ modules: () => {return {HelloWorld: import('../hello-world')}, render(props, loaded) {} } }) // Support for `render` when using a mapping, eg: `dynamic({ modules: () => {return {HelloWorld: import('../hello-world')}, render(props, loaded) {} } })
if (dynamicOptions.render) { if (dynamicOptions.render) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment