Giter Site home page Giter Site logo

jQuery is not defined about ztree-for-react HOT 3 CLOSED

arixse avatar arixse commented on June 20, 2024
jQuery is not defined

from ztree-for-react.

Comments (3)

arixse avatar arixse commented on June 20, 2024

我看下package.json里面的信息

from ztree-for-react.

lanchunlei avatar lanchunlei commented on June 20, 2024

var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
var path = require('path');
var proxy = require('http-proxy-middleware');

module.exports = {
context: path.join(__dirname),
devtool: debug ? "inline-sourcemap" : null,
entry: "./src/js/root.js",
module: {

loaders: [
  
  {
    test: /\.js?$/,
    exclude: /(node_modules)/,
    loader: 'babel-loader',
    query: {
      presets: ['react', 'es2015']
    }
  },

  //下面是使用 ant-design 的配置文件
  { test: /\.css$/, loader: 'style-loader!css-loader' }

  /*//下面是添加的 css 的 loader,也即是 css 模块化的配置方法,大家可以拷贝过去直接使用
  {
    test: /\.css$/,
    loader: 'style-loader!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]'
  },*/
]

},
output: {
path: __dirname,
filename: "./src/bundle.js"
},

devServer: {
historyApiFallback : true,//解决BrowserRouter不跳转问题
proxy : {
'/api/' : {
target : 'http://localhost:8090',//这里将符合 /api/... 的请求转发至此,实际是先转到 localhost:8080/api/
之后 webpack-dev-server转发至此
changeOrigin : true,
secure : true
}
}
},
plugins: debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
new webpack.ProvidePlugin({ //加载jq
$: 'jquery',
jQuery: 'jquery'
}),
],
};

{
"name": "party",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start" : "webpack-dev-server"
},
"author": "",
"license": "ISC",
"dependencies": {
"antd": "^3.1.6",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-import": "^1.6.3",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babelify": "^8.0.0",
"css-loader": "^0.28.9",
"echarts": "^4.0.4",
"echarts-for-react": "^2.0.8",
"fetch": "^1.1.0",
"jquery": "^3.3.1",
"mockjs": "^1.0.1-beta3",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-tinymce": "^0.7.0",
"style-loader": "^0.20.1",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1"
},
"devDependencies": {
"ztree-for-react": "^0.1.5"
}
}
谢谢,上面是webpack.config下面是package.json

from ztree-for-react.

arixse avatar arixse commented on June 20, 2024

应该是jQuery版本引起的问题,把jQuery版本换成2.2.1试试

from ztree-for-react.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.