Skip to content

Instantly share code, notes, and snippets.

@AlbinoDrought
Created November 20, 2020 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlbinoDrought/e6db92c14625a4906a8d4ba233ec22d1 to your computer and use it in GitHub Desktop.
Save AlbinoDrought/e6db92c14625a4906a8d4ba233ec22d1 to your computer and use it in GitHub Desktop.
Laravel Nova Custom Tool / Card / Dashboard unknown plugin error babel

Laravel Nova Custom Tool / Card / Dashboard Unknown Plugin Error

Saving this solution for later, might be able to google it next time it happens

Error:

Module build failed: ReferenceError: Unknown plugin "transform-object-rest-spread" specified in "base" at 0, attempted to resolve relative to "/nova-components/unified-transaction-api/dist"
    at /nova-components/NovaStuff/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (<anonymous>)
    at Function.normalisePlugins (/nova-components/NovaStuff/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/nova-components/NovaStuff/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/nova-components/NovaStuff/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/nova-components/NovaStuff/node_modules/babel-core/lib/transformation/file/index.js:212:65)
    at new File (/nova-components/NovaStuff/node_modules/babel-core/lib/transformation/file/index.js:135:24)
    at Pipeline.transform (/nova-components/NovaStuff/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transpile (/nova-components/NovaStuff/node_modules/babel-loader/lib/index.js:50:20)
    at /nova-components/NovaStuff/node_modules/babel-loader/lib/fs-cache.js:118:18
    at ReadFileContext.callback (/nova-components/NovaStuff/node_modules/babel-loader/lib/fs-cache.js:31:21)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (node:fs:273:13)
 @ ./node_modules/babel-loader/lib?{"cacheDirectory":true,"presets":[["env",{"modules":false,"targets":{"browsers":["> 2%"],"uglify":true}}]],"plugins":["transform-object-rest-spread",["transform-runtime",{"polyfill":false,"helpers":false}]]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./resources/js/components/Tool.vue 37:0-90
 @ ./resources/js/components/Tool.vue
 @ ./resources/js/tool.js
 @ multi ./resources/js/tool.js ./resources/sass/tool.scss

ERROR in ./resources/js/api.js
Module not found: Error: Can't resolve 'some-package' in '/nova-components/NovaStuff/resources/js'
 @ ./resources/js/api.js 1:0-85
 @ ./node_modules/babel-loader/lib?{"cacheDirectory":true,"presets":[["env",{"modules":false,"targets":{"browsers":["> 2%"],"uglify":true}}]],"plugins":["transform-object-rest-spread",["transform-runtime",{"polyfill":false,"helpers":false}]]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./resources/js/components/Tool.vue
 @ ./resources/js/components/Tool.vue
 @ ./resources/js/tool.js
 @ multi ./resources/js/tool.js ./resources/sass/tool.scss

Solution:

Add this to your webpack.mix.js:

  .webpackConfig({ resolve: { symlinks: false } }) // prevent webpack from looking for babel-plugins in ../api

webpack/webpack#1866 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment