【发布时间】:2018-08-27 09:59:39
【问题描述】:
背景
我有一个 elixir/phoenix 项目,使用默认的 brunch 设置(添加了一些附加功能,例如 sass 和 react)。
它已经工作了一段时间,但今天它自发停止编译任何东西,我不知道为什么。
症状
当我运行 brunch build --stdin 或 brunch watch --stdin 时,它只是挂起。没有任何东西被打印到控制台,没有任何东西被编译,没有错误。
当我运行brunch watch --debug --stdin
打印出来:
brunch:config Trying to load brunch-config +0ms
没有别的了。大概它从来没有真正加载过早午餐配置。
到目前为止我做了什么
- 仔细检查它在其他凤凰项目中仍然有效
- 删除所有 deps/node_modules,重新安装,然后重试。
brunch-config.js
exports.config = {
files: {
javascripts: {
joinTo: "js/app.js"
},
stylesheets: {
joinTo: "css/app.css"
},
templates: {
joinTo: "js/app.js"
}
},
conventions: {
assets: /^(static)/
},
paths: {
watched: ["static", "css", "js", "vendor"],
public: "../priv/static"
},
plugins: {
postcss: {
processors: [
require('autoprefixer')(['last 8 versions']),
require('csswring')()
]
}
},
modules: {
autoRequire: {
"js/app.js": ["js/app"]
}
},
npm: {
enabled: true
}
};
.babelrc
{
"presets": ["env", "stage-2", "react", "flow"],
"env": {
"development": {
"sourceMaps": "inline",
"plugins": ["source-map-support"]
}
},
"plugins": [
"syntax-object-rest-spread",
"transform-flow-strip-types",
"transform-es2015-destructuring",
"transform-es2015-parameters",
"transform-object-rest-spread",
["transform-runtime", {
"helpers": false,
"polyfill": false,
"regenerator": true,
"moduleName": "babel-runtime"
}]
]
}
package.json
{
"repository": {},
"name": "ewb",
"version": "1.0.0",
"license": "MIT",
"scripts": {
"deploy": "brunch build --production",
"watch": "brunch watch --stdin",
"test": "NODE_ENV=test jest --verbose"
},
"jest": {
"testEnvironment": "node",
"transform": {
"^.+\\.jsx?$": "babel-jest"
}
},
"dependencies": {
"autobind-decorator": "^2.1.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-runtime": "^6.26.0",
"extensible-runtime": "^4.1.0",
"immutable": "^3.8.2",
"lodash": "^4.17.5",
"normalize-scss": "^7.0.1",
"normalizr": "^3.2.4",
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html",
"react": "^16.2.0",
"react-phoenix": "file:../deps/react_phoenix",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
"redux-devtools": "^3.4.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0"
},
"devDependencies": {
"autoprefixer": "^8.0.0",
"babel-brunch": "^6.1.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-jest": "^22.4.1",
"babel-plugin-extensible-destructuring": "^4.2.0",
"babel-plugin-syntax-object-rest-spread": "^6.13.0",
"babel-plugin-transform-es2015-destructuring": "^6.23.0",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-flow": "^6.23.0",
"babel-preset-stage-2": "^6.24.1",
"brunch": "2.10.9",
"clean-css-brunch": "2.10.0",
"csswring": "^6.0.3",
"flow-bin": "^0.66.0",
"flow-brunch": "^0.2.4",
"jest": "^22.4.2",
"node-sass": "^4.7.2",
"postcss-brunch": "^2.1.0",
"regenerator-runtime": "^0.11.1",
"sass-brunch": "^2.10.4",
"uglify-js-brunch": "2.10.0"
}
}
【问题讨论】:
-
我以前也遇到过同样的问题。这通常是由 brunch-config.js 中引用的文件丢失引起的
标签: elixir phoenix-framework brunch