vue.js - 如何让我的 CSS 在 vuejs 中与 webpack 一起使用
问题描述
我试图让我的 vue js 加载我的 css 文件,但该应用程序似乎无法识别它。我也没有收到任何错误,所以试图找出从哪里开始甚至是困难的。有人知道为什么这不起作用吗?以下是我的文件,这是我的文件树的图像 - https://share.getcloudapp.com/KourXRmY
webpack.config.dev.js
'use strict'
const webpack = require('webpack')
const { VueLoaderPlugin } = require('vue-loader')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
mode: 'development',
entry: [
'./src/app.js'
],
devServer: {
hot: true,
watchOptions: {
poll: true
}
},
module: {
rules: [
{
test: /\.vue$/,
use: [
'vue-loader',
]
},
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
]
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
})
]
}
app.js(主 js 文件)
import Vue from 'vue';
import App from './App.vue';
import '../assets/app.css';
new Vue({
el: '#app',
render: h => h(App)
})
和我的css文件
body {
background-color: #000 !important;
}
.full-width {
width: 100%;
font-size: 500px;
}
.center-content {
display: flex;
justify-content: center;
align-items: center;
}
解决方案
推荐阅读
- javascript - 我怎么知道在 navigator.mediaDevices.enumerateDevices() 上返回的输入 MediaDeviceInfo 实际上是外部的
- c# - How can I decrypt a file in C# which has been encrypted by des.exe?
- python-3.x - 如何捕获新页面 selenium scrapy 的 url
- hibernate - InstantiationException:在 Kotlin 中使实体字段不可为空时,没有实体的默认构造函数
- typescript - 在我的应用程序中使用单例。我是否正确实施它?
- system-verilog - 带有变量的系统verilog绑定断言序列
- javascript - 有什么原因,为什么 HTML 表单中的禁用字段仍然被传输?
- xamarin.forms - Xamarin.Forms、iOS、Android 中的后台服务
- uwp - UWP 标题栏的自定义
- javascript - Vuetify 自动完成可以有两个数组吗?