question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loader didn't return a function error [3.0.0-beta1]

See original GitHub issue

When I try to upgrade from 2.x to 3.0.0-beta1 I start getting the following errors:

ERROR in Loader /Users/aahardy/dev/extension-support-testrunner/node_modules/inject-loader/lib/index.js didn't return a function
 @ ./src/lib/actions/__tests__/setCustomerIds.test.js 4:29-64

ERROR in Loader /Users/aahardy/dev/extension-support-testrunner/node_modules/inject-loader/lib/index.js didn't return a function
 @ ./src/lib/sharedModules/__tests__/mcidInstance.test.js 4:32-65

I’m guessing it has to do with the es6 modules in 3.x or something.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
oviavacommented, Sep 15, 2016
function inject(source) {
  this.cacheable && this.cacheable();
  return 'module.exports = ' + createInjectorFunction(this, source);
}

// Object.defineProperty(exports, "__esModule", {
//   value: true
// });
// exports.default = inject;

module.exports = inject;

a bit of hit & miss as I don’t understand webpack loader system that well but this fixed it for me

1reaction
zinclicommented, Oct 20, 2016

hey man, I guess you made a mistake on return value. like @oviava said

function inject(source) {
  this.cacheable && this.cacheable();
  return 'module.exports = ' + createInjectorFunction(this, source);
}

the return value should be a module, it should export some thing. so module.exports here should not omit.

#19 got everything broken.

Read more comments on GitHub >

github_iconTop Results From Across the Web

asp.net mvc - Webpack error 'Error: Final loader didn't return a ...
The solution was to do away with the /Content/server.js file, and instead use the expose-loader in webpack.
Read more >
Declaratively loading JavaScript - Fullstack React
In our load() function, we'll loop through the list of scripts and create a single script tag for each one, appending it to...
Read more >
Release Notes - PostGIS
This is a bug fix and security release. Important changes. Starting with this version offline raster access and use of GDAL drivers are...
Read more >
Loader Interface - webpack
A loader is a JavaScript module that exports a function. The loader runner calls this ... Then the loader must return undefined and...
Read more >
file-loader | Yarn - Package Manager
Bug Fixes · index: context takes precedence over issuer.context ( options.useRelativePath ) (3b071f5) · index: don't append outputPath to the original url ( ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found