Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

withSourceMaps is not a function #309

@Jauny

Description

@Jauny

Hi,

I'm trying to generate source-maps (ideally full source maps for production to debug a prod-only issue), but I can't get next-source-maps to work.

I've generate a new next.js project with only a pages/index.js page that says hello world. When following the readme for next-source-maps I get a withSourceMaps is not a function error.

next.conf.js

const withSourceMaps = require('@zeit/next-source-maps')({
  devtool: 'hidden-source-map'
})

module.exports = withSourceMaps(
  {
    webpack(config, options) {
      return config
    }
  }
)

the error when trying to yarn build

next (master) $ yarn build
yarn run v1.5.1
warning package.json: No license field
$ next build
TypeError: withSourceMaps is not a function
    at Object.<anonymous> (/Users/jonathanpepin/next/next.config.js:5:18)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at loadConfig (/Users/jonathanpepin/next/node_modules/next/dist/server/config.js:47:28)
    at _callee2$ (/Users/jonathanpepin/next/node_modules/next/dist/build/index.js:52:42)
    at tryCatch (/Users/jonathanpepin/next/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/Users/jonathanpepin/next/node_modules/regenerator-runtime/runtime.js:288:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/jonathanpepin/next/node_modules/regenerator-runtime/runtime.js:114:21)
    at asyncGeneratorStep (/Users/jonathanpepin/next/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js:5:24)
    at _next (/Users/jonathanpepin/next/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js:27:9)
    at /Users/jonathanpepin/next/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js:34:7
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c next build
Directory: /Users/jonathanpepin/next
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/Users/jonathanpepin/next/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

the project only has 1 page

next (master) $ ls
next.config.js	node_modules	package.json	pages		yarn-error.log	yarn.lock

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions