如何在 webpack 中使用 feathers 客户端

How to use feathers client with webpack

根据文档,我可以使用 feathers/client 但是当我尝试

让羽毛=要求('feathers/client'); 让 app = feathers();

是webpack编译的,我得到

./~/feathers/package.json
Module parse failed: /home/jiewmeng/Dropbox/expenses-app/node_modules/feathers/package.json Unexpected token (2:9)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:9)
    at Parser.pp.raise (/home/jiewmeng/Dropbox/expenses-app/node_modules/webpack/node_modules/acorn/dist/acorn.js:918:13)
    at Parser.pp.unexpected (/home/jiewmeng/Dropbox/expenses-app/node_modules/webpack/node_modules/acorn/dist/acorn.js:1480:8)
    at Parser.pp.semicolon (/home/jiewmeng/Dropbox/expenses-app/node_modules/webpack/node_modules/acorn/dist/acorn.js:1459:73)

怎么了?

他们的客户端包含这样一行:

createApplication.version = require('../../package.json').version;

这将使 webpack 处理他们项目的 package.json。除非您设置了 json-loader.

,否则这将失败