Vueで作ったやつをwebpackでビルドするのに失敗します。Curry.vue
という単一ファイルコンポーネントの中のstyleが処理できないようです:
<style scoped> .tomato { color: red; } </style>
エラーメッセージは下記です:
ERROR in ./src/components/Curry.vue?vue&type=style&index=0&id=4d934a99&scoped=true&lang=css& (./node_modules/vuetify-loader/lib/loader.js??ref--7-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Curry.vue?vue&type=style&index=0&id=4d934a99&scoped=true&lang=css&) 111:0 Module parse failed: Unexpected token (111:0) File was processed with these loaders: * ./node_modules/vuetify-loader/lib/loader.js * ./node_modules/vue-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | | > .tomato { | color: red; | } @ ./src/components/Curry.vue?vue&type=style&index=0&id=4d934a99&scoped=true&lang=css& 1:0-209 1:225-228 1:230-436 1:230-436 @ ./src/components/Curry.vue @ ./src/index.js
私のwebpack.config.js
は下記です:
JavaScript
1const path = require('path'); 2 3const HtmlWebpackPlugin = require('html-webpack-plugin') 4const VueLoaderPlugin = require('vue-loader/lib/plugin') 5const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin') 6 7module.exports = { 8 mode: 'development', 9 entry: path.join(__dirname, 'src', 'index'), 10 watch: true, 11 output: { 12 path: path.join(__dirname, 'dist'), 13 publicPath: '/dist/', 14 filename: "bundle.js", 15 chunkFilename: '[name].js' 16 }, 17 plugins:[ 18 new HtmlWebpackPlugin({ 19 template: './src/index.html' 20 }), 21 new VueLoaderPlugin(), 22 new VuetifyLoaderPlugin() 23 ], 24 module: { 25 rules: [ 26 { 27 test:/.vue$/, 28 use:['vue-loader'] 29 }, 30 { 31 test: /.jsx?$/, 32 include: [ 33 path.resolve(__dirname, 'src') 34 ], 35 exclude: [ 36 path.resolve(__dirname, 'node_modules') 37 ], 38 loader: 'babel-loader', 39 query: { 40 presets: [ 41 ["@babel/env", { 42 "targets": { 43 "browsers": "last 2 chrome versions" 44 } 45 }] 46 ] 47 } 48 }, 49 { 50 test: /.s(c|a)ss$/, 51 use: [ 52 'vue-style-loader', 53 'css-loader', 54 { 55 loader: 'sass-loader', 56 // Requires sass-loader@^7.0.0 57 options: { 58 implementation: require('sass'), 59 fiber: require('fibers'), 60 indentedSyntax: true // optional 61 }, 62 // Requires sass-loader@^8.0.0 63 options: { 64 implementation: require('sass'), 65 sassOptions: { 66 fiber: require('fibers'), 67 indentedSyntax: true // optional 68 }, 69 }, 70 }, 71 ], 72 }, 73 ] 74 }, 75 resolve: { 76 extensions: ['.json', '.js', '.jsx', '.vue'], 77 alias:{ 78 '@': path.resolve('src'), 79 } 80 }, 81 devtool: 'source-map', 82 devServer: { 83 contentBase: path.join(__dirname, '/dist/'), 84 inline: true, 85 host: 'localhost', 86 port: 8080, 87 } 88};
原因分かる方いますか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。