在Rails 7应用程序中使用esbuild,我已经成功地将代码拆分为2个包:一个带有StimulusJS控制器,另一个带有ReactJS应用程序。配置在开发中工作正常。
当推送到CI(GitHub操作)或直接推送到Heroku时,它会超时。
包. json
"scripts": {
"build": "node app/assets/config/esbuild.js",
"build:css": "sass ./app/assets/stylesheets/application.sass.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules"
}
配置文件
const path = require('path');
require("esbuild").build({
entryPoints: ["stimulus.js","article.js"],
bundle: true,
minify: true,
outdir: path.join(process.cwd(), "app/assets/builds"),
absWorkingDir: path.join(process.cwd(), "app/javascript"),
watch: true,
loader: { '.js': 'jsx' },
publicPath: 'assets',
target: 'es6',
// custom plugins will be inserted is this array
plugins: [],
}).catch(() => process.exit(1));
GitHub操作
yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.13s.
yarn run v1.22.19
$ node app/assets/config/esbuild.js
Error: The operation was canceled.
希鲁
挂在此台阶上
remote: $ node app/assets/config/esbuild.js
1条答案
按热度按时间ds97pgxw1#
解决方案是删除
watch: true
更新
对于其他正在与此斗争的人,请参见project上更新的解决方案和讨论。