Heroku部署错误Rails / webpacker ReferenceError:未知插件“ inline-react-svg”

时间:2019-12-25 23:06:02

标签: ruby-on-rails heroku webpacker

?

在将babel-plugin-inline-react-svg添加到package.json后尝试进入Heroku时,我收到“模块构建失败:ReferenceError:未知插件“ inline-react-svg”。我无法在本地复制它,但我一直在Heroku中得到它。

有什么想法吗?

错误

remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
...
remote:        Webpacker is installed ? ?
remote:        Using /tmp/build_15fd574408d6d2198a86094007ac9832/config/webpacker.yml file for setting up webpack paths
remote:        Compiling…
remote:        Compilation failed:
remote:        Hash: 7d0d7bb7df3a7fe42f08
remote:        Version: webpack 3.6.0
remote:        Time: 923ms
...
remote:
remote:        ERROR in ./app/javascript/packs/orders.jsx
remote:        Module build failed: ReferenceError: Unknown plugin "inline-react-svg" specified in "/tmp/build_15fd574408d6d2198a86094007ac9832/.babelrc" at 0, attempted to resolve relative to "/tmp/build_15fd574408d6d2198a86094007ac9832"
remote:            at /tmp/build_15fd574408d6d2198a86094007ac9832/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
remote:            at Array.map (<anonymous>)
remote:            at Function.normalisePlugins (/tmp/build_15fd574408d6d2198a86094007ac9832/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
remote:            at OptionManager.mergeOptions (/tmp/build_15fd574408d6d2198a86094007ac9832/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
remote:            at OptionManager.init (/tmp/build_15fd574408d6d2198a86094007ac9832/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
remote:            at File.initOptions (/tmp/build_15fd574408d6d2198a86094007ac9832/node_modules/babel-core/lib/transformation/file/index.js:212:65)
remote:            at new File (/tmp/build_15fd574408d6d2198a86094007ac9832/node_modules/babel-core/lib/transformation/file/index.js:135:24)
remote:            at Pipeline.transform (/tmp/build_15fd574408d6d2198a86094007ac9832/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
remote:            at transpile (/tmp/build_15fd574408d6d2198a86094007ac9832/node_modules/babel-loader/lib/index.js:50:20)
remote:            at /tmp/build_15fd574408d6d2198a86094007ac9832/node_modules/babel-loader/lib/fs-cache.js:118:18
remote:            at ReadFileContext.callback (/tmp/build_15fd574408d6d2198a86094007ac9832/node_modules/babel-loader/lib/fs-cache.js:31:21)

.babelrc

  "plugins": [
    "inline-react-svg",
    "syntax-dynamic-import",
    "transform-object-rest-spread",
    [
      "transform-class-properties",
      {
        "spec": true
      }
    ],
    [
      "transform-runtime",
      {
        "regenerator": true
      }
    ]
  ],

package.json

  "devDependencies": {
    "babel-jest": "^22.0.6",
    "babel-plugin-inline-react-svg": "^0.5.4",

1 个答案:

答案 0 :(得分:0)

我需要将babel-plugin-inline-react-svg移至dependencies,因为Heroku的安装没有devDependencies