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

Uncaught TypeError: __webpack_require__(...).filter is not a function #36

Closed
p2227 opened this issue May 4, 2016 · 2 comments
Closed

Comments

@p2227
Copy link

p2227 commented May 4, 2016

step1

npm install -g yo generator-react-webpack-redux

step2

# Create a new directory, and `cd` into it:
mkdir my-new-project && cd my-new-project

# Run the generator
yo react-webpack-redux

now if you npm start it works.
step3

npm i react-router react-router-proxy-loader -S

step4
modify index.js and add

import 'react-router';
import 'react-router-proxy-loader';

then it throw error above

the error code is

var emojiList = require("emojis-list").filter(function(emoji) {

var emojiList = require("emojis-list").filter(function(emoji) {
    return emojiRegex.test(emoji)
});

step5
modify index.js:

import 'react-router';
// import 'react-router-proxy-loader';

there is no error again

I think there are some conflicts between webpack loader-utils emojis-list and react-router-proxy-loader

@p2227
Copy link
Author

p2227 commented May 4, 2016

finally I solve it by adding json-loader

the conflict is : emojis-list exports a json file. there is no problem while it is in node environment.
but in webpack , the require function is rewrite to __webpack_require__ . it can't load json file without json-loader

@jhnns
Copy link
Member

jhnns commented Feb 21, 2017

The loader-utils are designed to be used in a node.js environment. I cannot think of a situation where you want to include your loader in your bundle :)

@jhnns jhnns closed this as completed Feb 21, 2017
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

2 participants