物化css和网页包问题,忽略大小写时具有相同名称的模块,JQuery

物化css和网页包问题,忽略大小写时具有相同名称的模块,JQuery,jquery,node.js,reactjs,webpack,materialize,Jquery,Node.js,Reactjs,Webpack,Materialize,我有一个基本的单页React/Redux应用程序,我正在使用Webpack捆绑,除了以下错误外,其他都正常工作,当我尝试加载materialise css js文件时。我尝试从NPM模块和编译源加载,错误是相同的 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

我有一个基本的单页React/Redux应用程序,我正在使用Webpack捆绑,除了以下错误外,其他都正常工作,当我尝试加载materialise css js文件时。我尝试从NPM模块和编译源加载,错误是相同的

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.
我正在加载输入文件顶部的所有内容,如下所示:

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");
new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery"
})
JQuery是从NPM模块加载的,如下所示:

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");
new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery"
})
现在一切都正常了,它加载了所有字体、js文件,应用程序中的一切都正常了,但是警告是有原因的,所以我真的想让它消失

如果你需要更多的信息,请告诉我

您可以在这里查看完整的源代码


谢谢

好的,所以我通过在materialize.js中更改来解决这个问题

jQuery = $ = require('jQuery');
对此

jQuery = $ = require('jquery');

简单的

幸运的是,没有必要更改materialize.js:-)

在网页包配置中添加:

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

这里有更多详细信息:

谢谢,这一定是materialize最新版本中的新版本,以前从未出现过。