Webpacker:已弃用resolve_paths选项改用Additional_paths

问题描述

我将webpacker从4.x更改为5.2.1,并开始收到此警告:

com.google.android.material.textfield.TextInputEditText
                android:id="@+id/etxt_step_duration"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Duração (em seg)"
                android:imeOptions="actionDone"
                android:textSize="16dp"
                android:inputType="number"
                android:lines="4"
                android:maxLines="4" />

这似乎很简单,我的The resolved_paths option has been deprecated. Use additional_paths instead. 几乎没有被修改

config/webpacker.yml

但是做一个简单的 # Additional paths webpack should lookup modules # ['app/assets','engine/foo/app/assets'] resolved_paths: [ 'app/assets',] 无效:

s/resolved_paths/additional_paths/

因此,显然[Webpacker] Compiling... [Webpacker] Compilation Failed: Hash: 7448f36a43523a84e146 Version: webpack 4.44.1 Time: 5803ms Built at: 10/15/2020 11:57:06 AM Asset Size Chunks Chunk Names js/application-a019b363e4513fe092e6.js 3.02 MiB application [emitted] [immutable] application js/application-a019b363e4513fe092e6.js.map 3.03 MiB application [emitted] [dev] application js/hello_react-40e806bdb6de496532d8.js 1.05 MiB hello_react [emitted] [immutable] hello_react js/hello_react-40e806bdb6de496532d8.js.map 1.21 MiB hello_react [emitted] [dev] hello_react js/server_rendering-9cd9dcc6e1cebb2a8063.js 2.25 MiB server_rendering [emitted] [immutable] server_rendering js/server_rendering-9cd9dcc6e1cebb2a8063.js.map 2.44 MiB server_rendering [emitted] [dev] server_rendering manifest.json 1.05 KiB [emitted] Entrypoint application = js/application-a019b363e4513fe092e6.js js/application-a019b363e4513fe092e6.js.map Entrypoint hello_react = js/hello_react-40e806bdb6de496532d8.js js/hello_react-40e806bdb6de496532d8.js.map Entrypoint server_rendering = js/server_rendering-9cd9dcc6e1cebb2a8063.js js/server_rendering-9cd9dcc6e1cebb2a8063.js.map [./app/javascript/channels sync recursive _channel\.js$] ./app/javascript/channels sync _channel\.js$ 160 bytes {application} [built] [./app/javascript/channels/index.js] 211 bytes {application} [built] [./app/javascript/components sync recursive ^\.\/.*$] ./app/javascript/components sync ^\.\/.*$ 2.42 KiB {application} {server_rendering} [built] [./app/javascript/packs/application.js] 10.3 KiB {application} [built] [./app/javascript/packs/hello_react.jsx] 1.05 KiB {hello_react} [built] [./app/javascript/packs/server_rendering.js] 301 bytes {server_rendering} [built] [./node_modules/webpack/buildin/amd-options.js] (webpack)/buildin/amd-options.js 80 bytes {application} {server_rendering} [built] [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 905 bytes {application} {server_rendering} [built] [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 552 bytes {application} {server_rendering} [built] + 474 hidden modules ERROR in ./app/javascript/components/menu/MenuComponent.jsx Module not found: Error: Can't resolve 'images/ellipsis-v.svg' in '/home/me/app/javascript/components/menu' 并非只是临时替代品,即使文档建议这样做也是如此。

在进入源代码以尝试了解这里发生的事情之前,有人快速修复了吗?

解决方法

错误记录在网络浏览器的控制台中,它来自 npm 包。您需要同时升级:webpacker gem 和@rails/webpacker npm 包。