laravel / nova-issues

554 stars 35 forks source link

Module build error when scaffolding a new tool. #4690

Closed bennettblack closed 2 years ago

bennettblack commented 2 years ago

Description:

Running php artisan nova:tool organization/toolname fails at the final step, when compiling the tools assets. I've made no edits or changes to the generated tool files. "CD'ing" into the tools directory and manually compiling also produces the same error.

Here's the error it generates:

ERROR in ./resources/js/pages/Tool.vue
Module build failed (from ./node_modules/vue-loader/dist/index.js):
TypeError: Cannot read properties of undefined (reading 'styles')
    at Object.loader (C:\laragon\www\bwi-online\nova-components\PermissionManager\node_modules\vue-loader\dist\index.js:70:34)

Here's the tool's package.json

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "prod": "npm run production",
    "production": "mix --production",
    "nova:install": "npm --prefix='../../vendor/laravel/nova' ci"
  },
  "devDependencies": {
    "@vue/compiler-sfc": "^3.2.22",
    "laravel-mix": "^6.0.41",
    "postcss": "^8.3.11",
    "vue-loader": "^16.8.3"
  },
  "dependencies": {}
}

And the webpack.mix.js

let mix = require('laravel-mix')

require('./nova.mix')

mix
  .setPublicPath('dist')
  .js('resources/js/tool.js', 'js')
  .vue({ version: 3 })
  .css('resources/css/tool.css', 'css')
  .nova('bwicompanies/PermissionManager')
crynobone commented 2 years ago

See https://github.com/laravel/nova-issues/discussions/4678#discussioncomment-3362616