简体   繁体   English

Vue JS 构建不导入 CSS 文件

[英]Vue JS Build not Import CSS Files

My CSS code that I imported into my Vue project and runs in the "npm run serve" section does not work on my server after "npm run build".我导入 Vue 项目并在“npm run serve”部分运行的 CSS 代码在“npm run build”之后在我的服务器上不起作用。 What could be the reason for this?这可能是什么原因? When I open the index file in the dist file on the local computer, it says CSS is missing, it does not say any error on the server.当我在本地计算机上打开 dist 文件中的索引文件时,它说 CSS 丢失,它没有说服务器上有任何错误。

main.js主程序

import Vue from 'vue'
import App from './App.vue'
import VRouter from './router'
import VStore from './configurations/storeConfiguration'
import V18n from './configurations/languageConfiguration'

// Special CSS Library ( UA )
import "./assets/scss/ua.css";

The CSS file that appears appears in the development environment.出现的CSS文件出现在开发环境中。 However, it does not appear in the server environment.但是,它不会出现在服务器环境中。

package.json package.json

  {
      "name": "driver",
      "version": "0.1.0",
      "private": true,
      "sideEffects": false,
      "scripts": {
        "serve": "vue-cli-service serve",
        "build": "vue-cli-service build",
        "lint": "vue-cli-service lint"
      },
      "dependencies": {
        "@fortawesome/fontawesome-svg-core": "^1.2.32",
        "@fortawesome/free-solid-svg-icons": "^5.15.1",
        "@fortawesome/vue-fontawesome": "^2.0.0",
        "axios": "^0.20.0",
        "bootstrap": "^4.5.3",
        "bootstrap-vue": "^2.17.3",
        "core-js": "^3.6.5",
        "epic-spinners": "^1.1.0",
        "node-sass": "^4.14.1",
        "sass": "^1.27.0",
        "sass-loader": "^10.0.3",
        "scriptjs": "^2.5.9",
        "sweet-modal-vue": "^2.0.0",
        "v-mask": "^2.2.3",
        "vue": "^2.6.12",
        "vue-analytics": "^5.22.1",
        "vue-ctk-date-time-picker": "^2.5.0",
        "vue-i18n": "^8.22.0",
        "vue-input-mask": "0.0.11",
        "vue-router": "^3.4.7",
        "vue-suggestion": "^1.1.0",
        "vue-sweetalert2": "^4.0.0",
        "vue-the-mask": "^0.11.1",
        "vue-toastification": "^1.7.8",
        "vuex": "^3.5.1"
      },
      "devDependencies": {
        "@vue/cli-plugin-babel": "~4.5.0",
        "@vue/cli-plugin-eslint": "~4.5.0",
        "@vue/cli-service": "~4.5.0",
        "babel-eslint": "^10.1.0",
        "eslint": "^6.7.2",
        "eslint-plugin-vue": "^6.2.2",
        "vue-template-compiler": "^2.6.11"
      },
      "eslintConfig": {
        "root": true,
        "env": {
          "node": true
        },
        "extends": [
          "plugin:vue/essential",
          "eslint:recommended"
        ],
        "parserOptions": {
          "parser": "babel-eslint"
        },
        "rules": {}
      },
      "browserslist": [
        "> 1%",
        "last 2 versions",
        "not dead"
      ]
    }

First things first: npm run serve does not serve the content of your dist file Check: How to run production site after build vue cli首先要做的事情:npm run serve does not serve the content of your dist file Check: How to run production site after build vue cli

Would you mind show some code so we can analyse your problem?您介意显示一些代码以便我们分析您的问题吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM