尝试使用node.js和ruby构建包部署到Heroku
对Heroku的Git推送调用buildpack和rake资产:运行预编译任务
不幸的是,这项任务在“编译”阶段失败了,对于要部署的每个css/scss资产文件,都会显示下面的错误
ERROR in ./app/assets/stylesheets/base.css
Module build failed (from ./node_modules/@rails/webpacker/node_modules/mini-css-extract-plugin/dist/loader.js):
TypeError: Cannot read property 'tap' of undefined
at ExternalModuleFactoryPlugin.apply (/tmp/build_4b756368/node_modules/@rails/webpacker/node_modules/webpack/lib/ExternalModuleFactoryPlugin.js:17:37)
at /tmp/build_4b756368/node_modules/@rails/webpacker/node_modules/webpack/lib/ExternalsPlugin.js:16:63
at Hook.eval [as call] (eval at create (/tmp/build_4b756368/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
at Hook.CALL_DELEGATE [as _call] (/tmp/build_4b756368/node_modules/webpack/node_modules/tapable/lib/Hook.js:14:14)
at /tmp/build_4b756368/node_modules/webpack/lib/Compiler.js:1028:23
at Hook.eval [as callAsync] (eval at create (/tmp/build_4b756368/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/tmp/build_4b756368/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
at Compiler.compile (/tmp/build_4b756368/node_modules/webpack/lib/Compiler.js:1025:28)
at Compiler.runAsChild (/tmp/build_4b756368/node_modules/webpack/lib/Compiler.js:495:8)
at Object.pitch (/tmp/build_4b756368/node_modules/@rails/webpacker/node_modules/mini-css-extract-plugin/dist/loader.js:126:17)
@ ./app/javascript/packs/application.js 6:0-42发布于 2021-03-16 07:43:05
我遇到了完全相同的问题,我按照这里的说明升级到了Webpacker的预发布版本:
https://github.com/rails/webpacker/blob/master/6_0_upgrade.md
这解决了我的问题,之后一切都正常了。
https://stackoverflow.com/questions/66272349
复制相似问题