Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
360 views
in Technique[技术] by (71.8m points)

nuxt.js - How do we configure nuxtjs with buefy in a custom server with express

I chose buefy as frontend framework to generate my nuxt app, and it does work find, but when I configure the package.json scripts to use node server.js (for a custom express server) to run in dev mode instead of the default nuxt command buefy doesn't work. I've tried to customized buefy and added the scss file in the ~/assets/scss/main.scss file but it doesn't change something. I don't get why it doesn't work when I use node instead of nuxt. If someone has a solution, I'd be grateful. Below are my package.json, ~/assets/scss/main.scss and nuxt.config.js

package.json

{
...
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "NODE_ENV=production node server.js",
    "generate": "nuxt generate"
  },
  "dependencies": {
    "@nuxtjs/axios": "^5.12.5",
    "core-js": "^3.6.5",
    "express": "^4.17.1",
    "mongoose": "^5.11.7",
    "nuxt": "^2.14.6",
    "nuxt-buefy": "^0.4.4"
  },
  "devDependencies": {
    "fibers": "^5.0.0",
    "sass": "^1.32.2",
    "sass-loader": "^10.1.0"
  }
}

~/assets/scss/main.scss

// Import Bulma's core
@import "~bulma/sass/utilities/_all";
// Set your colors
$primary: #8c67ef;
$primary-light: findLightColor($primary);
$primary-dark: findDarkColor($primary);
$primary-invert: findColorInvert($primary);
$twitter: #4099ff;
$twitter-invert: findColorInvert($twitter);
// Lists and maps
...

$link: $primary;
$link-invert: $primary-invert;
$link-focus-border: $primary;
// Import Bulma and Buefy styles
@import "~bulma";
@import "~buefy/src/scss/buefy";

nuxt.config.js

{...
  modules: ["@nuxtjs/axios", "nuxt-buefy"],
  css: ["~/assets/scss/main"],
...
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

After, revising my code, I found out I've set some Content Security Policies which blocked buefy after load, so I removed it and it works fine.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...