将socket.io与Brunch / Babel捆绑在一起时遇到了一些麻烦。
这是我的package.json:
{
[...]
"dependencies": {
"babel-runtime": "^5.8.0",
"classnames": "2.2.3",
"react": "^0.14.7",
"react-dom": "^0.14.7",
"react-redux": "^4.4.0",
"redux": "^3.3.1",
"socket.io-client": "1.4.5"
},
"devDependencies": {
"babel-brunch": "^6.0.0",
"babel-cli": "^6.5.1",
"babel-eslint": "^5.0.0",
"babel-preset-es2015": "^6.5.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.5.0",
"babel-register": "^6.5.2",
"brunch": "^2.4.2",
"css-brunch": "^2.0.0",
"eslint": "2.2.0",
"eslint-plugin-react": "4.1.0",
"fb-flo": "^0.5.0",
"fb-flo-brunch": "^1.7.22",
"javascript-brunch": "^2.0.0",
"rangen": "0.3.0",
"redux-devtools": "3.1.1",
"redux-devtools-dock-monitor": "1.1.0",
"redux-devtools-log-monitor": "1.0.4",
"sass-brunch": "2.0.0"
},
[...]
}
现在我的早午餐配置:
exports.config =
files:
javascripts:
joinTo:
'js/vendor.js': /^node_modules\//
'js/app.js': /^app\//
stylesheets:
joinTo:
'css/vendor.css': /^node_modules\//
'css/app.css': /^app\//
server:
run: yes
plugins:
babel:
presets: ['es2015', 'react', 'stage-0']
fbFlo:
enable: true
modules:
nameCleaner:
(path) ->
# remove app/js from all
newPath = path.replace(/^app\/js\//, '')
# if components or containers we remove component and the last file name
if newPath.match(/^components\//, '')
newPath = newPath.replace(/^components\/.*\//, '')
if newPath.match(/^containers\//, '')
newPath = newPath.replace(/^containers\//, '')
return newPath
autoRequire:
'js/app.js': ['app']
现在我的错误:
Uncaught Error: Cannot find module "engine.io-parser/keys" from "engine.io-parser"
@ vendor.js:61
如果我更换了我的vendor.js"要求(' ./ keys.js')"通过"要求(' ./ lib / keys.js')"这样可行 ... 我的问题在哪里?
谢谢