reselect icon indicating copy to clipboard operation
reselect copied to clipboard

Uncaught ReferenceError: createSelectorCreator is not defined

Open agile116 opened this issue 10 years ago • 10 comments

Hi,

I got Uncaught ReferenceError: createSelectorCreator is not defined when I use "jsnext:main", please help. Thanks.

agile116 avatar Apr 19 '16 07:04 agile116

@agile116 Show your code. And I think you don't use modules correctly.

import reselect from 'reselect';

and

import * as reselect from 'reselect';

are not the same. The first one imports only default export, which is empty object in this case. You can try

import { createSelectorCreator } from 'reselect';

And you can read http://www.2ality.com/2014/09/es6-modules-final.html

TrySound avatar Apr 19 '16 07:04 TrySound

@TrySound I'm using import { createSelector } from 'reselect'; It shows the above error in createSelector method.

agile116 avatar Apr 19 '16 23:04 agile116

index.js?2b69:62 Uncaught ReferenceError: createSelectorCreator is not definedcreateSelector @ index.js?2b69:62(anonymous function)

agile116 avatar Apr 19 '16 23:04 agile116

Hi, @agile116, there could be quite a few variables at play here. How are you compiling your code (Webpack, Browserify, Rollup, etc)? Does this error get thrown when you try to compile or is it a runtime error? Any other details about your build process and a more complete example of the code you're using would be very helpful I think.

There's also an issue open regarding the jsnext:main build so that could be related (#103).

npbee avatar Apr 20 '16 02:04 npbee

Hi npbee, I'm using webpack 2 with mainFields: ["jsnext:main","webpack", "browser", "web", "browserify", ["jam", "main"], "main"]. This is an runtime error, compile seems good. If I remove "jsnext:main", runtime error would be gone.

agile116 avatar Apr 20 '16 03:04 agile116

Hm, took a quick try and I wasn't able to reproduce the error you're seeing, seems to work ok for me. Are you able to provide your full webpack config and a sample of the code you're using? I'm not sure I'll be able to help much more without that.

npbee avatar Apr 20 '16 03:04 npbee

Hi npbee,

I think your change yesterday may fix the "jsnext:main" issue, is it possible to publish it to npm? Thanks. Add jsnext build Add a build step for jsnext:main, compiling all non-ES5 features except for modules.

agile116 avatar Apr 21 '16 01:04 agile116

@agile116 v2.5.0 published on npm

ellbee avatar Apr 21 '16 12:04 ellbee

thanks, I'll try it tomorrow. :)

在 2016年4月21日,下午8:24,Lee Bannard <[email protected]mailto:[email protected]> 写道:

@agile116https://github.com/agile116 v2.5.0 published on npm

― You are receiving this because you were mentioned. Reply to this email directly or view it on GitHubhttps://github.com/reactjs/reselect/issues/114#issuecomment-212892937

agile116 avatar Apr 21 '16 12:04 agile116

It is fixed with the latest version. Thanks. :)

agile116 avatar Apr 22 '16 04:04 agile116