Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: SourceNode.fromSourceWithMap is not a function #237

Closed
tschaub opened this issue Apr 19, 2017 · 0 comments
Closed

TypeError: SourceNode.fromSourceWithMap is not a function #237

tschaub opened this issue Apr 19, 2017 · 0 comments

Comments

@tschaub
Copy link
Contributor

tschaub commented Apr 19, 2017

I'm submitting a bug report

Webpack version:
2.4.1

Webpack Karma version:
2.0.3

Karma version:
1.6.0

Please tell us about your environment:
OSX 10.11.6

Browser: Chrome 57

Current behavior:

If your webpack config is an array (if mocha is "wrapped") and if you are using sourcemaps (e.g. with the devtool option), you see errors like this logged:

TypeError: SourceNode.fromSourceWithMap is not a function
    at Object.module.exports (/path/to/karma-webpack-test/node_modules/karma-webpack/lib/mocha-env-loader.js:25:29)
    at LOADER_EXECUTION (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:119:14)
    at runSyncOrAsync (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:120:4)
    at iterateNormalLoaders (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
    at iterateNormalLoaders (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:218:10)
    at /path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:233:3
    at Object.context.callback (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at Object.module.exports (/path/to/karma-webpack-test/node_modules/babel-loader/lib/index.js:172:8)
    at LOADER_EXECUTION (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:119:14)
    at runSyncOrAsync (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:120:4)
    at iterateNormalLoaders (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
    at Array.<anonymous> (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:202:4)
    at Storage.finished (/path/to/karma-webpack-test/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:15)
    at /path/to/karma-webpack-test/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:69:9
    at /path/to/karma-webpack-test/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)

If you are not using sourcemaps (but if you still have an array for the webpack config), you see errors like this logged:

Error: callback(): The callback was already called.
    at Object.context.callback (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:106:10)
    at Object.module.exports (/path/to/karma-webpack-test/node_modules/karma-webpack/lib/mocha-env-loader.js:42:8)
    at LOADER_EXECUTION (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:119:14)
    at runSyncOrAsync (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:120:4)
    at iterateNormalLoaders (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
    at iterateNormalLoaders (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:218:10)
    at /path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:233:3
    at Object.context.callback (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at Object.module.exports (/path/to/karma-webpack-test/node_modules/babel-loader/lib/index.js:172:8)
    at LOADER_EXECUTION (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:119:14)
    at runSyncOrAsync (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:120:4)
    at iterateNormalLoaders (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
    at Array.<anonymous> (/path/to/karma-webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:202:4)
    at Storage.finished (/path/to/karma-webpack-test/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:15)
    at /path/to/karma-webpack-test/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:69:9
    at /path/to/karma-webpack-test/node_modules/graceful-fs/graceful-fs.js:78:16

Expected/desired behavior:

No extra output.

Here is a gist that reproduces the issue: https://gist.github.com/tschaub/b7700159dad789c4a0b91f2038dd0f58

tschaub added a commit to tschaub/karma-webpack that referenced this issue Apr 19, 2017
 * Work with source maps

 * Avoid calling callback twice
tschaub added a commit to tschaub/karma-webpack that referenced this issue May 4, 2017
 * Work with source maps

 * Avoid calling callback twice
joshwiens pushed a commit that referenced this issue Nov 10, 2017
* Work with source maps

 * Avoid calling callback twice
mattlewis92 pushed a commit that referenced this issue Dec 14, 2017
* Work with source maps

 * Avoid calling callback twice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant