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

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

Closed
Aaronius opened this issue Sep 7, 2016 · 7 comments · Fixed by #19
Closed

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

Aaronius opened this issue Sep 7, 2016 · 7 comments · Fixed by #19
Assignees
Labels

Comments

@Aaronius
Copy link
Contributor

Aaronius commented Sep 7, 2016

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.

@plasticine
Copy link
Owner

@Aaronius thanks will have a look 👍🏼

@plasticine plasticine self-assigned this Sep 13, 2016
@plasticine plasticine added the bug label Sep 13, 2016
@oviava
Copy link

oviava commented 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

@lvthanh101
Copy link

hi @plasticine, do you have plan to fix this bug?

@plasticine
Copy link
Owner

@lvthanh101 Yep, just haven’t had time. Hopefully soon.

@zincli
Copy link

zincli commented 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.

@zincli
Copy link

zincli commented Oct 20, 2016

@plasticine
Copy link
Owner

Please check out 3.0.0-beta3 which should fix this issue and also introduces support for webpack2.

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

Successfully merging a pull request may close this issue.

5 participants