2

I have a basic single page React/Redux app that i am bundling using Webpack, all is working fine except the following error when i try to load the materialise-css js files. I have tried loading from the NPM module and the compiles source and the errors are the same.

WARNING in ./~/jQuery/dist/jquery.js
There is another module with an equal name when case is ignored.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Rename module if multiple modules are expected or use equal casing if one module is expected.

WARNING in ./~/jquery/dist/jquery.js
There is another module with an equal name when case is ignored.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Rename module if multiple modules are expected or use equal casing if one module is expected.

I am loading everything at the top of my entry file as follows:

import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import ReduxPromise from 'redux-promise';

import App from './components/app'
import reducers from './reducers'

require('../materialize/css/materialize.css');
require('../materialize/js/materialize.js');
require("../style/main.scss");

and JQuery is loaded from an NPM module as follows:

new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery"
})

Now everything still works, it loads all the fonts, js files, and everything works/looks correct in the application, but a warning is there for a reason so i would really like to make it go away!

Let me know if you need any more information.

You can view the full source code here https://github.com/gazzer82/freeCodeCamp_Recipes

Thanks

2 Answers 2

5

Ok so i fixed this by changing this in materialize.js

jQuery = $ = require('jQuery');

To this

jQuery = $ = require('jquery');

Simples . . . .

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for that, this must be new in one of the last version of materialize, didn't happen before.
2

Fortunately there is no need to change materialize.js :-)

In webpack config add:

module.exports = {
  // ...
  resolve: {
      alias: {
        jQuery: "path/to/jquery/dist/jquery"
      }
  }
  // ...
};

More details here: https://github.com/Dogfalo/materialize/issues/2690

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.