我使用Webpack创建了我的项目并在开发中使用了Vue.js,但我无法注入<style>Vue模板.
它让我
Module parse failed: Unexpected token (18:5)
You may need an appropriate loader to handle this file type.
|
|
> body {
| background-color: red;
| }
Run Code Online (Sandbox Code Playgroud)
这是我的 webpack.config.js
...
module: {
rules: [{
test: /\.vue$/,
loader: "vue-loader"
},
{
test: /\.js$/,
loader: "babel-loader",
exclude: /node_modules/,
options: {
presets: ["@babel/preset-env"]
}
},
]
},
Run Code Online (Sandbox Code Playgroud)
还有我的 App.vue
<template>
<div id="app">
<counter></counter>
</div>
</template>
<script>
import Counter from "./app/Counter.vue";
export default {
name: "app",
components: {
counter: Counter …Run Code Online (Sandbox Code Playgroud)