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,12 +120,16 @@ export default function dynamic<P = {}>( ...@@ -120,12 +120,16 @@ 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 (
process.env.NODE_ENV !== 'production'
) {
if(dynamicOptions.modules) {
console.warn( 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' '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) {
loadableOptions.render = (loaded, props) => loadableOptions.render = (loaded, props) =>
......
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