bartve / disconnect

An easy to use Node.js client with OAuth support to connect with the discogs.com API v2.0
MIT License
457 stars 79 forks source link

including disconnect in react app #29

Closed wechta closed 7 years ago

wechta commented 8 years ago

Hi, i found your library for Discocgs, but i have a problem including it in my app.

I tried many ways: import Discogs from 'disconnect/lib/client' import Discogs from 'disconnect'; var Discogs = require('disconnect').Client;

Every time i get this error:

ERROR in ./~/disconnect/package.json Module parse failed: C:\WORK\budgies\node_modules\disconnect\package.json Unexpected token (2:8) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (2:8)

I googled and found and tried many things like: http://stackoverflow.com/questions/33469929/you-may-need-an-appropriate-loader-to-handle-this-file-type-with-webpack-and-b

My webpack.js is like this:

`var path = require('path') var webpack = require('webpack')

module.exports = { devtool: 'cheap-module-eval-source-map', entry: [ 'webpack-hot-middleware/client', './index' ], output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js', publicPath: '/static/' }, plugins: [ new webpack.optimize.OccurenceOrderPlugin(), new webpack.HotModuleReplacementPlugin(), new webpack.NoErrorsPlugin() ], module: { loaders: [ { test: /.js$/, loaders: [ 'babel' ], exclude: /node_modules/, include: __dirname } ] } } `

My package.json is like this:

{ "name": "redux-todomvc-example", "version": "0.0.0", "description": "Redux TodoMVC example", "scripts": { "start": "node server.js", "test": "NODE_ENV=test mocha --recursive --compilers js:babel-core/register --require ./test/setup.js", "test:watch": "npm test -- --watch" }, "repository": { "type": "git", "url": "https://github.com/rackt/redux.git" }, "license": "MIT", "bugs": { "url": "https://github.com/rackt/redux/issues" }, "homepage": "http://rackt.github.io/redux", "dependencies": { "babel-polyfill": "^6.3.14", "classnames": "^2.1.2", "es6-promise": "^3.1.2", "isomorphic-fetch": "^2.2.1", "react": "^0.14.6", "react-bootstrap": "^0.28.4", "react-dom": "^0.14.6", "react-redux": "^4.0.6", "react-youtube": "^5.1.0", "redux": "^3.0.6", "redux-persist": "^4.0.0-alpha7", "redux-sequence-action": "^0.2.0", "redux-thunk": "^0.1.0", "immutability-helper": "^2.0.0", "disconnect": "^1.0.2" }, "devDependencies": { "babel-core": "^6.3.15", "babel-loader": "^6.2.0", "babel-preset-es2015": "^6.3.13", "babel-preset-react": "^6.3.13", "babel-preset-react-hmre": "^1.1.1", "babel-register": "^6.3.13", "expect": "^1.8.0", "express": "^4.13.3", "jsdom": "^5.6.1", "json-loader": "^0.5.4", "mocha": "^2.2.5", "node-libs-browser": "^0.5.2", "raw-loader": "^0.5.1", "react-addons-test-utils": "^0.14.0", "react-transform-hmr": "^1.0.0", "style-loader": "^0.12.3", "todomvc-app-css": "^2.0.1", "webpack": "^1.9.11", "webpack-dev-middleware": "^1.2.0", "webpack-hot-middleware": "^2.2.0" } }

I also have babelrc:

{ "presets": ["es2015", "react"], "env": { "development": { "presets": ["react-hmre"] } } }

What is wrong? Cannot i use disconnect like this?

bartve commented 8 years ago

I'm sorry but I don't use React, nor do I have the desire to actively investigate client side use of disconnect as it's intended as a server side Node.js tool. I'm open to pull requests that don't break anything server-side though.